Hacker News new | ask | show | jobs
by 0xblinq 510 days ago
> I’m not against Tailwind, but I didn't used it yet because I struggle to see why it's a better approach compared to other options like Web Components or React Styled Components.

> The biggest issue I have with Tailwind is how it clutters the HTML

You're 100% clearly in the first group. Maybe I shouldn't have said "hate" in that group, just people that don't like it or see its benefits.

> Like Web Components

That's a nice solution, but in practice as of today and relatively speaking: nobody is using them.

> and Styled Components

Except the performance is a lot worse. And you still have to come up with names for every single div that needs a minimal one line style.

And both of these solutions end up with huge CSS files. Huge CSS files are worse than having larger HTML markup, because CSS is a blocking resource and HTML is not.

> I really value keeping HTML very short and readable by not mixing presentational styles directly in the markup

People used to say this about React, they preferred their HTML separate from their JavaScript, all nice and clean. I'm now 150% sure you're in the first group.

> Yes, I've read the docs but never tried it out, I don't hate it, but I can't understand why I would choose it over other options. The fact of having a million classes in the middle of plain HTML makes them both unreadable for me.

Alright, now you've recognized it.

> These two approaches allows me to not have to read presentational things in the middle of my html, and allow my html to be more clear and readable.

That's a non issue. There are extensions that will just hide classnames. You're just blending your mind looking for reasosn to justify your "I don't like it".

I promise the day you use it in a real life project where you're working with > 3 other people you will understand it's benefits, and how having "large class lists" is a non-issue and a totally acceptable trade off over the practical benefits it provides. Both on performance of the resulting CSS and maintainability over a large period of time. And think in the insane amount of discussions you'll avoid regarding if we're calling this div "styledDivWrapper" or "WraperContent" or "CardWrapper" or ".card__item--dark". Not an issue if you work alone, but when working with others this becomes a real annoyance that tailwind completely removes.

Tailwind is not for your, don't use it.

Tailwind is not for purists and architecture philosophers.

Tailwind is for pragmatic people, working on real life projects within teams where they have to ship and spend less time philosophizing on the purity and beauty of things.