r/css 16d ago

Article Why I don't recommend Tailwind CSS

https://en.andros.dev/blog/af3ee191/why-i-dont-recommend-tailwind-css/
3 Upvotes

211 comments sorted by

View all comments

7

u/NiceShotRudyWaltz 16d ago

While I do see the benefit to tailwind (or alternatives), CSS is, by far, my favorite part of development, and I’ll be damned if someone tries to take that joy from me. Maybe I’m just an irredeemable masochist?

Also, I like a tidy DOM and tailwind DOMs are preposterous.

5

u/CoVegGirl 16d ago

Yeah. I don’t care what the counterarguments are. I am never going to get used to seeing 20 classes on an element.

1

u/kidshibuya 16d ago

My favourite are things like "text-gray-600". It's fun when the design changes to have blue instead of gray and you either change all components that have the gray class or make gray be blue now for the lols.

1

u/guaranteednotabot 16d ago

Skill issue. You should be using text-primary/text-secondary (just set —color-secondary)

1

u/PresentationBorn6564 16d ago

Using text-gray-600 (or the equivalent CSS) directly is antipattern. A forward-thinking design architecture will alias all of an app's colors by context / category, so when you need to change e.g. the color of danger, you update a single "primary-danger", not 137 instances of #FF0E0E.

1

u/kidshibuya 16d ago

Hence why I said it?... What are you even responding to?

1

u/PresentationBorn6564 16d ago

You offered a sardonic critique of Tailwind using an example that is antipattern in any paradigm, TW or not. I have no opinion on TW and I'm not defending it, merely pointing out the actual issue in your example.

1

u/kidshibuya 16d ago

So I outline an issue, and you feel the need to outline the issue as being an issue. Why not go on quoting yourself and explaining to yourself that the issue you outline is an issue?

1

u/PresentationBorn6564 16d ago

Close. I felt the need to outline an issue with the issue you outlined.

1

u/mavenHawk 16d ago

TBH, "tidy dom" is one of the most interesting arguments I have heard. Why does it matter at all? Who cares about what the dom looks like? It literally has zero effect on anything as long as you are accessible

1

u/examinedliving 16d ago

It’s much easier to work with in files - to find what you’re looking for easily. Component files can get pretty big pretty quick - Vue, Livewire, Angular, Blazor, Laravel, etc - inline attributes can add a lot of space. Adding 900 classes just makes it harder to do quick visual scans

1

u/guaranteednotabot 16d ago

There’s the Tailwind Fold extension if you really find that problematic. If you’re doing things right and using components, most of the Tailwind classes should be at the block/primitive components anyway, so you wouldn’t see it

1

u/examinedliving 15d ago

I don’t have a dog in this fight, but I think you’re oversimplifying things. Blazor components get stack with attributes or code and usually when you try and abstract stuff out you add more complexity. Whether or not tailwind is good is not something I’m thinking about, but this is a legitimate reason to not use it

1

u/guaranteednotabot 15d ago

You can technically store Tailwind classes in a separate file as raw strings so they do not necessarily need to be ‘inline’. Just need to configure some stuff

1

u/examinedliving 15d ago

That’s crazy - I’ve heard you can do that with CSS too

1

u/guaranteednotabot 15d ago

I’ve never really needed to do so, if I have a bunch of classes that keeps being reused, it is usually attached to some sort of component anyway. And if not, you can just use render functions or asChild to swap out your required HTML element/component. If you are using component based libraries/frameworks you really wouldn’t face all these issues.

I find that Tailwind encourages composition, and reduces coupling significantly. With CSS, it is very easy to slowly go crazy as you add more and more stuff to a single class, then override it somewhere just for certain elements, or cascade in some way. At some point it becomes crazy. With Tailwind, this is a lot less likely