r/webdev • u/AllThingsSmitty • Mar 30 '17
CSS is Fine, It’s Just Really Hard
https://medium.com/@jdan/css-is-fine-its-just-really-hard-638da7a3dce07
u/ahoy1 Mar 30 '17
It's a funny article, but it doesn't make a case for the proposed "solution" at all. It doesn't seem meaningfully different than <div class="text-bold margin-auto border-bottom-thin">(with the associated single-property class definitions in a CSS file).
Why is this better than that?
2
u/Lyxs Mar 30 '17
Those were my thoughts exactly. It just seems like extra work to achieve the same result as having single property css classes. With the downside that you must now include js in your page, wether you need it or not.
1
u/jordanscales Mar 30 '17
You are correct - it is essentially the same as that! Component classes are a beautiful pattern, which is why things like http://tachyons.io/ have been so well-received.
"CSS-in-JS" solutions like aphrodite have the output of something like BEM, with the authoring experience of something like Tachyons. You can write component classes, or mixins (whatever abstraction you'd like, really), and you know the output is sound and won't collide with anything in the DOM. Properties like
line-heightwill still cascade down and muddy the waters a bit, but you always reset."Well I can just do that without JavaScript" Great! Please do! But also understand that we're human and we make typos. Or make the wrong abstractions, and that's why I let the robots do the manual work for me.
14
u/lamb_pudding Mar 30 '17
I don't like this article. The author doesn't really explain the reason they like the JavaScript rendered CSS. Also, it's not perfect, it uses !importants.