DEV Community

loading...

Discussion on: Why Tailwind? A long term user perspective

Collapse
moopet profile image
Ben Sinclair

Bloating the HTML by eliminating the separation of concerns is a trade-off

I don't particularly have a problem with Tailwind provided you don't do this. You don't have to, since it compiles down to regular CSS like every other tools does. If you write simple semantic markup and apply utility classes in the CSS part, you don't need to bloat your HTML.

The problem is, that's not an improvement on how people do CSS in the first place, and it's also not how people use Tailwind in the real world.

Collapse
ecklf profile image
Florentin / 珞辰 Author

The problem is, that's not an improvement on how people do CSS in the first place, and it's also not how people use Tailwind in the real world.

I do agree @apply gets rid of the benefits, and this is why you should avoid using it. It is openly discouraged to be used by the author. However, it comes quite in handy when you need to style something globally.

Collapse
king11 profile image
Lakshya Singh

I actually use @apply under two situations when I don't want people to easily copy of my design from just looking at HTML and second when I have conditions like the one Adam showed related to lists of similar element. I would probably make a new component and then apply scoped css using selectors on it with @apply this prevents the bloated HTML. I am doubtful though whether HTML vs @apply which one will bloat my css.