Hacker News new | ask | show | jobs
by nightski 1694 days ago
I think the thought process is that if you are using Tailwind it's probably with a component based system like React. So you don't need a button "name" because you have a button component. You re-use components instead of classes.

This makes it so you don't have to remember all the names specific to the project (or learn an existing projects css names).

I've never used Tailwind myself so I am not advocating it per say, just explaining how I understand it.

3 comments

After 20+ years of HTML, CSS I started to use Tailwind for a new project. Using web components (disabling the shadow dom unfortunately).

You guessed it right. There is no need for named selectors anymore.

And you get the advantages of standardisation. People can share snippets of code you can reuse as is.

And when you have a problem, you are probably not the first to have it, and can quickly find a solution on youtube, stack overflow, etc.

Embracing components over classes is what helped me understand and appreciate functional CSS (Tachyons, Tailwind, etc). Lots of headaches removed when the DOM structure finally 1:1 reflects the style inheritance structure, without having to maintain the latter separately.
the code-reuse is such a boon
Exactly. When using something like React, the abstraction of using classes to create reusable components is redundant with the framework's, and thus no longer carries its weight. Especially considering how, in practice, that abstraction isn't that effective in the first place: it's rare that a layout change involves just a CSS change. (I'm somewhat rehashing from a blog post of mine [1] here - if anyone wants this more extensively argued they can read that.)

[1] https://vincenttunru.com/why-tailwind/#the-right-abstraction

Also you avoid writing CSS and designing like before CSS existed. Its more messy but a bit easier to learn then CSS. CSS is simply too advanced and powerful it takes years to master. Ohh and you can copy/paste components into your spaghetti code.
>Also you avoid writing CSS and designing like before CSS existed.

I know this is controversial because of the web dev canon of "lol CSS sucks", but many people really love CSS, and find it incredibly powerful and enjoyable to use. If you put in the time to truly learn it, these tools seem silly and redundant.

So you're using Tailwind fine, but find CSS too advanced? But you gotta master CSS to know what Tailwind is doing.

Otherwise, you're just improvising.