![]() ![]() The enforced control over selectors enables some new capabilities that we couldn’t do easily before eg - we can trivially extract critical css for html by matching the ids to rules, meaning we can load a page with just 1-2k of css that the page needs for initial render. We should use a computer's assistance us on this, and not rely on humans being infallible (they’re not!) (In fact, scoping selectors is pretty much the only thing css modules does, and it’s hugely popular and useful for just this.)įurther, it’s extremely hard to statically analyse selectors to see whether any rules are broken (or even a typo!) this means constraints have to be enforced via code reviews and education, which is a harder problem to solve and scale. ![]() This is exacerbated with third party libraries. While strategies like oocss, etc are conceptually great, relying on selectors to enforce those architectures are hard in a global namespace because there is always a chance of a clash if not now, 3 years in the future when the team has changed and become bigger and whatnot. The biggest win from cij is that computers generate selectors for you automatically. So the big deal about css-in-js (cij) is selectors. ![]() ![]() Also, some of the stuff I’m writing might seem obvious to you I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context) In return, I promise to listen to you too and change my opinions I’ve had mad respect for you for years and would consider your feedback a gift. (These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings as such it’s useful for some usecases, and not meant as a replacement for all workflows. “In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?” ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |