←back to thread

Tailwind CSS v4.0 Beta 1

(tailwindcss.com)
168 points creativedg | 4 comments | | HN request time: 0.646s | source
Show context
emmacharp ◴[] No.42213520[source]
I invite (for fun and learning!) anyone here still thinking native CSS provides no efficient solution to the problems Tailwind may have solved 5 years ago to challenge me:

Bring up any said problem and I'll give you an efficient, robust, fast, simple and maintainable way to solve it in pure, native CSS (maybe even with further advantages!).

The time has come to embrace good ol' CSS again! Heheh.

replies(3): >>42213590 #>>42214487 #>>42238577 #
naasking ◴[] No.42238577[source]
> Bring up any said problem and I'll give you an efficient, robust, fast, simple and maintainable way to solve it in pure, native CSS (maybe even with further advantages!).

I'd like to not have to read or write CSS. Let's see you tackle that. ;-)

replies(1): >>42239863 #
1. Vinnl ◴[] No.42239863[source]
Well, Tailwind doesn't really solve that for you either - you pretty much have to know CSS to be able to use it effectively, in my experience. Technically, you may not really be writing CSS, but in practice, I think all the reasons you might have for not wanting to write CSS still apply to writing Tailwind.
replies(1): >>42246196 #
2. naasking ◴[] No.42246196[source]
Not quite, with Tailwind:

1. you need to know the specific effects of the individual directives but you don't need to deal with the cascading behaviour and other complexities.

2. you don't need to leave your local markup to make styling changes.

3. you don't need to synchronize selectors across multiple files (non-locality).

And because Tailwind involves a lot of repetition of the same CSS classes for the same markup, it naturally drives you towards defining reusable HTML components that encapsulate the markup and CSS classes.

There are a lot of subtle usability improvements like this that avoid CSS footguns and make dev UX better overall.

replies(2): >>42246794 #>>42250587 #
3. emmacharp ◴[] No.42246794[source]
1. Which part of the cascade do you struggle with? Because it can make your code really simple and efficient!

2. If you link your CSS inside your component you have a direct access to it. A simple editor split suffice to edit it. I would say that's a pretty standard workflow.

3. You can force (with Stylelint, for instance) the use of scoped selectors in CSS files, essentially preventing any selector spillover (which is a real problem). Scoping component selectors inside the one and only corresponding CSS file is important and achievable without complex code dependencies.

4. The drive to define reusable components should already be natural enough on its own! Heheh.

By approaching CSS with the good tools and mindset, you can have a great dev experience while preventing complex dependency chains, third party rules/lock-in. You can also use the most recent CSS features not implemented in Tailwind (looking at you clamp()!) to provide a better end-user experience more easily.

It's a great time to rediscover CSS!

4. Vinnl ◴[] No.42250587[source]
That's fair enough, but I do still expect that someone who really wants to avoid CSS will still be put off by the extent to which Tailwind still is, in essence, CSS. I think Tailwind has advantages (the ones you note), but "being able to not learn CSS" is not it.