|
|
|
|
|
by stevebmark
1694 days ago
|
|
I don't get it. CSS Modules are designed to be combined with global utility classes. Using mainly utility classes is some OOCSS shenanigans we stopped doing literally decades ago. And CSS-in-JS has worse performance because styles aren't compiled to sytlesheets like they're supposed to be, they're applied at runtime. Downloading JS > parsing JS > executing JS > generating stylesheets > injecting stylesheets in to the DOM dynamically > repaint + reflows is how you get poor performance. CSS is a solved problem and that solution is CSS modules with global utility classes compiled to static stylesheets. |
|
That depends on the tool. Libraries like Linaria [1] ("zero-runtime" CSS-in-JS) do generate CSS files.
[1] https://linaria.dev