I Don't Like Tailwind
Who cares if I like or don't like something, right? I have had some questions as to reasons, so here are the basics.
What is Tailwind
Tailwind CSS is a CSS library that leans heavily on utility classes. You compose them in the HTML class attribute. You can see some examples of resulting CSS and HTML on their website.
It's Just Taste
I don't like Tailwind. But it's no big deal. It's just a matter of taste. And like some matters of taste, there might not be much beyond like or dislike.
But I'll try to list some reasons.
If you use it, know that this is not personal. Use it, even love it, and I hope your projects turn out great.
Low-value Abstraction
I just don't think it gives you much. Well, it gives you a lot (that's different)! But its net value-add beyond what you had (CSS) is low.
It's a new language. You don't think in CSS selectors and attributes. You think in tailwind config and abbreviations. Learn them all. Now do what you could have done with CSS.
It gives you "new" capabilities. But it's just another way to do the same thing you could already do. For instance, now you can inline your media queries (eg. md:bg-blue
) But you had them before -- just in a media query (eg, @media
).
Now you have new limitations. CSS can do everything that CSS can do. But Tailwind can never do more. Often, it'll do less. For instance, to use something like @container
queries, I have to install a plugin for Tailwind. But then I'm asking myself, "Why am I adding a plugin to use a CSS feature?"
It feels like a new landscape, but not any better than what it blankets.
Skill Value
When I learn Tailwind, I learn a library. When I learn CSS, I learn a native language of the web. Both evolve, but the library will die much sooner. And I'll move projects sooner still.
I want to escape the library churn where possible and learn the skill that will last the longest and be most portable.
Another Tool
Tailwind is another tool. And if it's low-value, then the toolchain complexity tradeoff is not good.
Adding Tailwind lengthens the toolchain. There's a new library to keep up to date. A configuration to get right. More code to compile.
I usually don't want PostCSS or Sass either. I'd rather write browser-ready CSS.
CSS lately allows me to do everything I need to do when styling on the web.
Prefer Stylesheets
I like writing my styles in a stylesheet (ie, a .css
file).
I like it better than inline styles. And better than tagged template literals in JS. I like it better than a bunch of util classes.
There is a strong use case for CSS in JS: in shipping JS-only UI libs. But I like a stylesheet for my apps.
Starts Centralized
Tailwind is opinionated. This is a reason some people like it. Fair.
I don't like that it's a centralized opinion, especially to start. Everything flows from a central tailwind.config.js
file. There's a variable for everything.
I'd rather start distributed. No configuration to learn at the start. There's no reason to have a variable for something if it's used once. Promote that thing to a constant after the need is proved. Have less configuration overall.
It's Ugly
A huge list of selectors in the class attributes in markup is ugly. I don't like the aesthetic. I think it muddles the HTML. I think reading the list of selectors is a pain.
When you want to make a change, parsing it with your eye is lame.
Just an Opinion
This isn't a balanced perspective. It's just my taste and opinion.
My opinion doesn't matter much. I think it's ok to have an opinion without much of a reason, especially on something trivial like a CSS library. I just don't like it.
Just a Library
It's just a library. It's not a way of life. Same with native CSS. These are not high-stakes life choices.
You can actually write CSS without Tailwind.
If you like the library, install it, run it, and I wish you very well-styled apps.