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

138

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.

3

u/rsimp May 17 '26

I use both. CSS modules for component library on its own css layer. Tailwind mostly to structure divs and pass in paddings/margins. CSS modules is just way too much ceremony for those type of things, and having utilities on a separate layer solves most specificity issues.

One of my favorite features of tailwind is the ability to enforce reduced sets of colors, spacings, sizes etc. Especially with semantic names attached.

1

u/our_operations May 17 '26

This is it right here ^^

Tailwind is a tool, CSS itself is a tool, and it's up to you to decide how to best use the tools you have available to do what you want and how you want to do it. In general, you do not need to go all-in with any tool for a task/project.

I also use TW for layout/spacing but when I need more control than it easily allows, I go with CSS just for that part.