Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use insertRule instead of appendChild in production #115

Closed
kentcdodds opened this issue Jul 27, 2016 · 7 comments
Closed

Use insertRule instead of appendChild in production #115

kentcdodds opened this issue Jul 27, 2016 · 7 comments

Comments

@kentcdodds
Copy link
Contributor

So check this out:

screen shot 2016-07-26 at 8 28 11 pm

Based on @threepointone's experience, I suggest that we explore the possibility of doing this. Mostly because of this:

screen shot 2016-07-26 at 8 30 44 pm

Thoughts? 💭

@jlfwong
Copy link
Collaborator

jlfwong commented Jul 27, 2016

Perhaps see #83?

@kentcdodds
Copy link
Contributor Author

Ah! That's right, totally forgot about that PR 👍 cc @threepointone, see #83

@kentcdodds
Copy link
Contributor Author

Closing as this is already tracked in #76

@threepointone
Copy link

Don't forget the tradeoff, you wouldn't want to use this in dev. Cheers all!

@xymostech
Copy link
Contributor

@threepointone What do you mean when you say that the styles aren't editable? Like, you can't edit them in the style inspector, or you can't edit the contents of the style sheet?

@threepointone
Copy link

The former; this is the main caveat with this method. https://bugs.chromium.org/p/chromium/issues/detail?id=387952#c6

@threepointone
Copy link

Dunno if you folks have made any progress on this, but thought this might help. I extracted just the 'stylesheet' parts of glamor into a generic module. It handles using appendChild in dev vs insertRule in production (if available), uses multiple backing tags to expand rule space, and also has a server side 'shim'. I've tested it fairly throughly for both bugs and perf, and I like it so far. Please feel free to import { StyleSheet } from 'glamor/lib/sheet', and / or copy paste and modify for your own purposes. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants