News for hackers. Stuff that matters.
Re:CSS Utility Classes and “Separation of Concerns” (2017) by jameslk on Saturday November 16, 2019 @03:51PM (#21554875)
Maintenance of these utility class CSS codebases is such a pain. I've had the pleasure of dealing with it. What if you want to tweak one of your utility classes ever so slightly? If your codebase is big enough, you've just created enormous amounts of potential regressions.
Re:CSS Utility Classes and “Separation of Concerns” (2017) by andrethegiant on Saturday November 16, 2019 @07:25PM (#21555804)
This is why CSS-in-JS solutions outshine utility classes IMO – if you deal with stylesheets directly, it's hard to avoid treating CSS as append-only files that grow linearly with the size of your codebase. With CSS-in-JS, on the other hand, the styles get generated for you, at a size that grows logarithmically to the size of your codebase (style rules of the same value get pulled into their own deduped classes).
Re:CSS Utility Classes and “Separation of Concerns” (2017) by meerita on Saturday November 16, 2019 @03:53PM (#21554887)
Give me an example of that.

Would you mantain .display--block? how? .color--red?

Re:CSS Utility Classes and “Separation of Concerns” (2017) by jameslk on Saturday November 16, 2019 @04:02PM (#21554928)
It would be some domain-specific component. Like .product-card. I don't see the examples you've given. Those are so literal, you might as well use inline styles at that point.
Re:CSS Utility Classes and “Separation of Concerns” (2017) by meerita on Saturday November 16, 2019 @04:19PM (#21555017)
That's the problem functional CSS solves: class naming doesn't relay on developer intervention, it's just a translation of the utility.

Product-card is not an utility, that's why it's a problem to maintain such classes.

Re:CSS Utility Classes and “Separation of Concerns” (2017) by Izkata on Saturday November 16, 2019 @04:29PM (#21555080)
Changing the saturation of the red and causing it to look messy alongside surrounding elements/images? Or introducing colorblindness concerns elsewhere in the app?
Re:CSS Utility Classes and “Separation of Concerns” (2017) by meerita on Saturday November 16, 2019 @04:44PM (#21555174)
That means two things: you need extra utitilies to have different reds or, you don't mind to adjust the same red that will impact in the rest of the website. As a designer I do this all the time. If my design is complex to the point I would need several reds, then i would use a different value in the class name, like numbers or other options.

Then my workflow for that case would be: create the new color value, compile the CSS, change the class name in those places where I want to use the new red.

Re:CSS Utility Classes and “Separation of Concerns” (2017) by rhythnic on Saturday November 16, 2019 @04:04PM (#21554939)
The biggest win when using functional css, or css utility classes, is that it is extracted out into a library already, in which case there is nothing to create or maintain (just the downside of messy classnames).

https://tailwindcss.com