3 ms·
"I wanted to find a way to easily control the CSS from the server side and not have to worry about pre-building the css to take variables and stuff. I didnt wan
by andrewfromx 2y ago
"I wanted to find a way to easily control the CSS from the server side and not have to worry about pre-building the css to take variables and stuff. I didnt want to use UI libraries that are written for JS frameworks and I didn't want to use preprocessors or linters that add more steps to the build process.
The benefit of all this are
Keeps the css free of variables.
Keeps html free of classes like bg-gray-50 text-black dark:bg-slate-800 dark:text-white and eliminates the need to remember to add the dark variant.
I recently saw a button component on an html page 10 times with over 1800 characters in the class attribute of each!"
- JasonSage 2y agoWhy is keeping the css free of variables a benefit?
- promiseofbeans 2y agoYeah CSS variables are great, and enable a bunch of super dynamic stuff without needing any JS!
- aniforprez 2y agoI 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
- marziply 2y agoYou'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.
- shiomiru 2y ago* 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)
- zer00eyz 2y ago> I recently saw a button component on an html page 10 times with over 1800 characters in the class attribute of each!" In my head you went full bene gesserit and screamed "abomination" when you saw it. Candidly I want to know where this thing was, you really need to name and shame.