3 ms·
Another project, which also uses the idea of atomic CSS classes is Styletron [0]. Perhaps their "introductory blog post" [1] better explains the "why". All in
by djedr 9y ago
Another project, which also uses the idea of atomic CSS classes is Styletron [0].
Perhaps their "introductory blog post" [1] better explains the "why".
All in all this has some interesting performance benefits.
It may look insane, but as long as you don't have to manually make and use these atomic classes this is not such a bad idea.
I think the things such as atomic CSS, CSS-in-JS, CSS Modules, styled-components, inline styles, etc. are all symptoms of something being seriously wrong with CSS and at the same time attempts to fix these problems. They are pushing in the positive direction.
I recommend checking out [2] if somebody is interested in these topics. That's where I found out about Styletron.
Cheers.
[0] https://github.com/rtsao/styletron https://github.com/rtsao/styletron
[1] https://ryantsao.com/blog/virtual-css-with-styletron https://ryantsao.com/blog/virtual-css-with-styletron
[2] https://medium.com/seek-blog/a-unified-styling-language-d0c208de2660 https://medium.com/seek-blog/a-unified-styling-language-d0c2...
- Mikhail_Edoshin 9y agoI have a desktop publishing background and I'd say that CSS is way less convenient than the common desktop publishing styling model. In desktop publishing you assign styles to certain classes of page elements (paragraphs, character runs, graphics, tables, etc.) and you can base a style on another style, that's all. There's no element-element inheritance, only style-to-style inheritance. This is not ideal, I think, but you never get any surprises that are so common in CSS. If I were to design a better styling model, I'd take that desktop-publishing model and added multiple inheritance (something you can model in XSL-FO with XSLT attribute templates) and maybe tried to have pattern-based rules, but not hierarchical as in CSS. What you normally need is to be able to specify that "add that much space between a table and a paragraph", "remove first line indent if the paragraph comes after a picture", "do not add space if the paragraph is at the top of the page", and so on. All this seems to be based on a particular arrangement of sibling elements, not of parent-child relationship. The only exception I can think of are tables, but they seem to be special anyway.