I think the best defense of Tailwind's approach is from Adam Wathan in this post.
https://adamwathan.me/css-utility-classes-and-separation-of-...
I use a flavour of BEM naming with an approach I call Contexts and Components to achieve concise, low inheritance CSS and I can see how Tailwind can get you similar benefits and solve for some stuff traditional CSS has a hard time solving within frontend frameworks.
I am still fighting picking it up, but that is the use case I see for it, component driven workflows.
What everyone said to avoid was actually just wrong. Semantic CSS failed. Tailwind (or utility classes in general) is the best way to implement a reasonably-maintainable and properly-specified version of putting things in the style attribute.
If you don't want to do that then you could watch some of Adam Wathan's screencasts on YouTube where he uses Tailwind to recreate pages or build new ones.
https://www.youtube.com/c/AdamWathan/videos?view=0&sort=p&fl...
This smells a lot like every other tech bandwagon. It's the best thing since sliced bread until wide adoption exposes all the flaws and we go back to what proceeded it.
Something seems fundamentally off about this library, but I can't pinpoint what.
I waited a while before bothering with React, but based on my positive experience with that particular 'paradigm shift' I gave Tailwind a shot. So far it's been really, really pleasant on a moderately-sized project, so that's hopeful.
I don't see the point in dismissing it, based on all that. We didn't go back from React to jQuery and Backbone, we moved forward from it.
That said, it's fair enough and probably smart to wait and see at this point if you don't have the luxury of experimenting. I totally get that.
Others here have provided reasons why Tailwind is great, and many comments just center around how it's at least not a bad idea.
But for myself, I read a lot of these arguments before and wasn't convinced until I used it in a fairly big project. To some extent it's hard to explain the benefits because once you get past the more 'ideological' issues (separation of concerns, etc.), it's really much more about how it affects the flow of day to day work. I don't think any arguments would've really convinced me, but because of the excitement around here I gave it a shot, and was convinced by seeing how my project grew without many of the usual CSS issues I'd run into (as well as the convenience of just not having to switch to a stylesheet file most of the time).
But I do understand how frustrating a comment like that can be.
There is an influential presentation from, i think, someone on the react team that started the whole CSS-in-JS thing. It just advocated for using inline styles. I can‘t seem to find it.
React and Vue have special handling of the inline style attribute to make it more pleasant to use, so it‘s not been fully discouraged for a while.
https://blog.vjeux.com/2014/javascript/react-css-in-js-natio...
Imagine styling a table row. That is one style attribute. Now imagine styling a 100 tables rows. That is style attribute duplicated a 100 times. Think of the amount of unnecessary bandwidth consumed to load that HTML file with 100 duplicate style attributes. Not only does it slow down page load times, it also slows down page render times.
Now if you add selectors to style attributes then it solves the above issue altogether. But, then you are just re-inventing the wheel. Instead of CSS in a separate file you now have the same functionality but all inlined in style attributes.
Page load times are interesting, but again, unless you're loading an insane amount of data from the server, it will never be a real issue.
Some sort of component architecture solves the problem you bring up w/ duplication. You should never be writing the same thing 100x over. JS frameworks all render 100's of the same component with the same attributes and performance is fine for 99% of real use cases.
The downsides for Tailwind all revolve around personal preference and how your team organizes a project. There is no performance hit (unless you ship the entire un-purged CSS file to production, even then, it's minimal).
What? Do you ever leave the city? It seems like that’s an unsupported use case any many developers minds.
So in this situation you would have a <my-row /> component, which would contain the tailwind classes. This reduces load time as duplication is eliminated, but I'm not sure it would reduce the render time.
They still cascade normally like CSS classes... see this example:
<div style="color: red">
<p>red text</p>
<p>red text</p>
<p style="color: blue">blue text</p>
</div>
Ironically, it's actually complex CSS classes and long selectors that produce high specificity, which then requires even more specificity to override and eventually the dreaded !importantAnd yes, definitely it's just that it changed the development workflow slightly, not at all that it brings new possibilities and a much better developer experience.