DEV Community

Discussion on: TailwindCSS: Adds complexity, does nothing.

Collapse
 
kerryboyko profile image
Kerry Boyko

Even the things that Tailwind "simplifies" are made more complex, and "ring" is a perfect example.

I'll admit, rings are difficult in CSS, which is why if I need to make one, I usually end up writing my own utility class for it.

But even looking at "ring" you end up having to add 5 classes or more to get your ring styled the way you want it. So "ring" ends up being "ring-3 ring-blue-300 ring-opacity-50 ring-offset-0 ring-offset-red-500" by the time you actually use it.

On the other hand, you could define all those into an actual utility CSS class, call it ".branded-ring" and just use that wherever you need it (instead of having that long string of five classes everywhere in your file.) Or even better, you could write branded-ring as a SCSS variable or a bit of styled component css`` code. If you use a CSS-in-JS solution, you could even have the color of the ring change according to props, giving you behavior control over style.

And it would be more readable, more customizable, and then you don't have to worry about it. You would be able to write it once, and then your entire team could just import your code and reuse it - rather than every developer having to remember how to tailwind-style a ring every time they use that.

Of course, rings aren't that difficult to do, because Google is a thing that exists, and there are a dozen websites which explains how exactly to do it.

Of course, what happens when the CSS spec updates and rings are added due to popular demand? It happened with flexbox. It happened with css-grid. You never know.

Thread Thread
 
thedutchcoder_57 profile image
Reinier Kaper

You can use @apply, which does the exact same thing.
It allows you to make a single class .branded-ring while still leveraging Tailwind's classes.

Thread Thread
 
moopet profile image
Ben Sinclair

You can do that in things like Sass, too. It's not a benefit of Tailwind.

Thread Thread
 
thedutchcoder_57 profile image
Reinier Kaper

But that's the point. It's not a good example of how using regular CSS (or pre processed CSS) is "better" in this case, it's not.

Thread Thread
 
moopet profile image
Ben Sinclair

I'm not sure I follow. I'm saying that having the same feature as an existing build process doesn't make the new one better, it makes it the same. I'm saying that the claim is that BMW make better cars than Ford because BMWs have four wheels.

Thread Thread
 
thedutchcoder_57 profile image
Reinier Kaper

It's not a valuable claim in the original article.

He doesn't like/use Tailwind as he doesn't see the benefit over using what he already does.

That's fine and totally reasonable, but it's not an argument against Tailwind. His whole article is about how Tailwind is useless.

Maybe to him it is, fine, no one argues that. But that doesn't make Tailwind useless in general.

His examples are supposed to show how bad Tailwind is. It isn't. It just doesn't fit him or his way of writing CSS.

Cool, absolutely nothing wrong with that, but again that didn't make Tailwind useless or bad in any way.