|
|
|
|
|
by Zalastax
3493 days ago
|
|
A big issue I see with CSS-in-JS at this moment is server-side-rendering and caching. You started working on a babel-transform for extracting static styles but seem to have changed your mind about actually extracting that to a css-file[1]. Requiring a JS-parser to apply the styles is the wrong approach but might be a stepping stone as it's probably an easier problem to solve. Separating JS and CSS should improve performance somewhat as the browsers can run the scripting and styling engine separately. In the end I'd like a transformation that creates one CSS-file per JS-file so that common chunks can be combined by webpack, gaining high cache hit percentage on sites that uses reloads. Transformations should also be applied to the JS so that SSR doesn't have to calculate styles each time. [1]: https://github.com/styled-components/styled-components/issue... |
|
We also almost have a proper server-side rendering API[0], in case you haven't seen that PR before. Should be released very soon!
[0]: https://github.com/styled-components/styled-components/pull/...