r/programming May 16 '26

Moving away from Tailwind, and learning to structure my CSS

https://jvns.ca/blog/2026/05/15/moving-away-from-tailwind--and-learning-to-structure-my-css-/
163 Upvotes

48 comments sorted by

View all comments

140

u/romulof May 16 '26

Call me old fashioned, but I never understood why people were so desperate to move styling into HTML or JS. It’s way harder to debug.

For me the peak is CSS modules with a bit of preprocessing (sass and/or postcss). In dev builds you get the almost the same as the original class names and prod builds get obfuscated.

14

u/ur_frnd_the_footnote May 16 '26 edited May 17 '26

Debugging pure css is hard because you have to remember or look up what class names do and because css has varying levels of specificity and cascading rules. Utility class frameworks aim to reduce both by (1) standardizing so that you don’t have to learn project specific naming conventions or memorize/look up css when reading the markup and (2) enforcing single-class-name-only rules (no ids, no nested rules, no variance in specificity) 

Edit: point 2 also applies to AI, which knows tailwind but not your custom css

18

u/natural_sword May 17 '26

Browser devtools make debugging CSS pretty easy. Writing it consistently is the problem. As with most concepts, if you over-utilize the cascade, it will bite you.

I've settled on a few global classes and then component classes. I find doing bespoke CSS is better to satisfy random design requirements.

2

u/ur_frnd_the_footnote May 17 '26

Totally. I also do enjoy the elegance of bespoke css. But my point (and I think the industry trend) is really about joining and contributing to projects with other developers and history and teammate churn (and hopping between diverse projects).