-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add support for client-side batching to generate fewer <style> tags. #1
Conversation
<div id='root'>{html}</div> | ||
<script src="./bundle.js"></script> | ||
<script>StyleSheet.markInjected({classNames});</script> | ||
</body> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script>ReactDOM.render(<App />, document.querySelector("#root"))</script>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that strictly worse than document.getElementById
? Seems like querySelector should just be slower because it needs to the the string parser to figure out to search by id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like yes: https://jsperf.com/getelementbyid-vs-queryselector
I mostly wanted to mention to add the corresponding client-side ReactDOM.render
call.
09d3273
to
f7d0b3b
Compare
injectionBuffer = ""; | ||
}, | ||
|
||
css(styleDefinitions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed, correct? (since it's now merged into css
below?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, yep -- bad merge
This all looks fine to me (except for the function to be removed)! |
70cb73f
to
9891cb6
Compare
This also adds some examples to the repo, and paves the path forward for serverside rendering. Test Plan: cd examples npm install npm run examples Open http://localhost:4114/, see 2 style tags generated: one for initial render, one for the dynamic blue added by the timer.
9891cb6
to
8e30455
Compare
Add support for client-side batching to generate fewer <style> tags.
This also adds some examples to the repo, and paves the path forward for serverside rendering.
Test Plan:
Open http://localhost:4114/, see 2 style tags generated: one for initial render, one for the dynamic blue added by the timer.
@xymostech