Hacker News new | ask | show | jobs
by Aeolos 118 days ago
You just make a design system in your tailwind.css, following the documentation. You can optionally use something like daisyui if you do not have designer skills or the time.

That handles consistent sizing, spacing, text, colors, dark mode, and anything else your design system needs. It all compiles down to css in the end, so no runtime overhead and gives you the superior tailwind dx during development.

3 comments

Almost none of that is specific to Tailwind though, you can take any design system in CSS with or without JS and make the same argument right?
What do you think tailwind is?

It's a utility to generate deduped/treeshacken css classes - according to a config file the parent mentioned

It's not some grand framework or something.

It's literally doing exactly what the grand parent said. Define root css variables, and generate the applicable/used css classes that were used in the code

I use Tailwind for work and hobby projects and what you said is exactly what I think Tailwind is and why I use it.

I don’t understand where the disagreement is. I was only pointing out a lot of the “magic” from Tailwind’s abstraction isn’t as magical as the GP you referred to implies.

I see, I must've misunderstood your comment earlier.
The poster I responded to, specifically asked for how to implement this in tailwind, with a worry about "do you really style each component separately for dark mode? Repeating the same modifiers over and over?"

I simply answered his question - tailwind is indeed just plain old CSS with a more ergonomic DX.

We are stuck with CSS, but all these CSS styling frameworks just tell me CSS needs to be bulldozed. I looked up DaisyUI that you mentioned. The example on the home page gets rid of chained classes and replaces them with one:

// Styling a simple button <button class="btn"> daisyUI Button </button>

So, we are back to regular CSS?

Congratulations, you reinvented regular CSS.
If that is so, why are people getting up in arms about tailwind?
If it's just CSS then why would I use Tailwind instead of the actual thing? It's a layer of indirection for no reason if it's the same.
If BEM is regular CSS, why would I use BEM instead of the actual thing? It's a layer of indirection for no reason if it's the same.

You use Tailwind in the same way you use BEM: becuase it makes it easier for frontend developers to write correct CSS.

You're right which is why I don't use BEM, it has no advantages over regular CSS, same with Tailwind.
You do you, but thankfully the rest of the industry disagrees with you.