Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does inline utility classes help with not creating a mess with a team?

Merits of semantic classes and class hierarchies are very debatable. And CSS dropped the ball with style composition (which e.g. SCSS fixes). And media/container query ergonomics aren't ideal. But essentially hardcoding styles inline is a very weird reaction to these. A bit like "let's get rid of variables and hardcode values in functions because OOP inheritance caused a mess".



The article linked in the grandparent directly explains how utility classes are different from inline styles: there are infinitely many possibilities with inline styles; not so with utility classes. The empirical numbers in the article are fascinating. 400+ different colors in a single CSS project that’s supposed to be “semantic”. With utility classes, you are forced to choose from a finite set of colors.


That is not a matter of using inline utility classes. You can and probably should use e.g. CSS variables or @apply preprocessors to enforce a finite set of colors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: