Hacker News new | ask | show | jobs
by blorenz 702 days ago
Every time something with tailwind is posted there is always a rehash of this response. I believe most of this frustration comes from using tailwind in the raw. There are a few essential libraries available that amplify the power of tailwind by magnitudes: tailwind-merge for last-specified wins, and class-variance-authority to reduce your class declarations in coherent reusable variants.

Tailwind empowers the expressiveness of styling. I steadfastly counter that the statement that it is the eccentric artist who insists on using every color in the palette. By design, tailwind implements constraints on what can be utilized by it's configuration file. Sure, you can absolutely break out with arbitrary classes but the spirit is akin to a Crayola box of 64 crayons and you have to work with what you have in front of you.

The largest benefit is that I can read my JSX/HTML and understand the presentation of the elements. Nothing is cryptic. I don't have to dive into another file where I can lose cognitive load. DX is enhanced. Critically stated: tailwind has been nothing but a massive boon for web dev since its inception.

2 comments

Your last argument is a perfect reason why tailwind isn't a fad. Its a standard where, if you've worked with it, you know exactly what these classes will do. Saying "the classlist becomes long" is not an argument to avoid using tailwind, especially if you already have a component based framework. I'd rather read a tailwind classlist than having to spend time setting up my own half-arsed class list.
Interesting response.

I'm in this war against build steps.

Is there a way to 80/20 Tailwind without the build steps?

I mean, get 80% of the benefits with 20% of the work.

Yes, CSS variables. Defining a preset of variables on :root for sizes and color ranges goes a long way.

The design philosophies behind Tailwind are sound, but like so many I dislike the technical implementation. I feel like there is a lot of halo effect happening with Tailwind where judgement of technical merits is influenced by judgement on visual merits.

Interesting. Seems quite well supported.

https://caniuse.com/css-variables

You may use CDN build of UnoCSS (16k GH stars) https://unocss.dev/integrations/runtime which generates styles on the fly for 80% of benefits with 0% build steps (even with regular HTML)

It does have quirks compared to build variant, so if you use a framework, using it in a build step may be better, it'll still be much lighter then tailwind

Yes: https://unocss.dev/

You can even use it directly in runtime https://unocss.dev/integrations/runtime

Give 60% to someone else