Hacker News new | past | comments | ask | show | jobs | submit login

Why is keeping the css free of variables a benefit?



I am also yet to ever find a reasonable explanation for why adding HTML classes a la tailwind is ever bad for the end user. I can see the argument for the DX suffering cause you have a ton of classes in one long line and that can make things a bit unreadable but why does the user or the browser care how many classes there are? The browser has optimised workflows to bunch up all the styles in all those classes to render the elements and all more classes would mean is a few extra bytes to download


You've literally answered you own question - DX. To some, developer experience and the ergonomics of utility is more important. Others aren't of that mindset which is equally okay. I'm guessing you're of the latter camp in this case.


* at least FF dev tools get unusable with enough variables (and in general, it's not a fun experience to debug which one out of a thousand others is wrong)

* efficiency (one less hash lookup, less bookkeeping for the browser)

* works on older browsers (or mine ;)

* you become a member of the exclusive club of devs that don't believe in turning CSS into a turing-complete language (old fashioned, I know)


Yeah CSS variables are great, and enable a bunch of super dynamic stuff without needing any JS!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: