Hacker News new | ask | show | jobs
by seer 878 days ago
Hmm, I’ve always considered tailwind like the spice to make css actually usable, kinda like elixir is to erlang, typescript is to javascript or C is to machine code. Its still CSS just the stuff that you _actually_ want to build is pre-packaged and thought out for the use case.

And I’m not dissing on CSS - just those tools try to solve different problems.

CSS is the ground truth, and it kinda has to support all the weird edge cases and uses that tailwind doesn’t.

Tailwind is like usability overhaul of css, but still allows you to “drop down to css” everywhere you want to.

It can compose like css, but it also constraints you to what you can do. It also gives you tools to group, adjust, refine styles, but in a usable way.

It’s a transpiled language on top of css, but more ambiguous than sass or less.

Given enough time most projects I work with slowly gravitate towards small composable utility classes anyway, tailwind is just logical evolution of that.

And since design peojects usually gravitate towards design systems in the long run, tailwind is really good at facilitating that.

1 comments

What makes tailwind feel wrong for me is that you put the css classes everywhere exactly like you would set inline style attribute. I would prefer using the css slectors and select by an id or class name and apply a css like that. I avoid frontend but this is how I see it used in my team.

Would be nicer if you could do it like selector > color-xyz text0xyz paddifng-xyz and never add those classes inline

Oh yeah it does feel weird “dirty” somewhat.

But to your suggestion - you can! Thats what components classes do in essence. When you have a bunch of styles that _always_ go together - you bunch em up.

But in practice it is usually simpler to keep the classes and use other templating features of your platform to achieve this.

It becomes extremely nice as every time you need the question “why is my html look like this” answered, there is no hierarchy of other files to dig through - its all just there.

And as with any tool you can abuse it in ways that are not intended - seen plenty of ugly tailwind examples with tons of weird unruly code. But thats even more true for css itself. Omg the horrors I’ve seen with custom raw css cans still give me nightmares.

I know there are many tutorials doing that, but that is not how I use Tailwind. Tailwind entirely supports your own CSS files and you can use @apply to compose all of the existing classes together.
Thanks for the tips