DEV Community

Discussion on: What are your thoughts on Tailwind CSS?

Collapse
 
tornography profile image
Manuel Schulz

(I actually registered, just to answer here)

I get the point, why tailwind css is so popular. Especially when you don't like or understand css. But there are some points, fans bring up, that I don't get or see different.

"Predefined values" or "no magic numbers"
Setting up a predefined subset of values is possible in sass/less or even with css custom properties like

$margin-2: 0.4rem; // sass/scss
--text-color-dark: #222; // css custom vars
Enter fullscreen mode Exit fullscreen mode

And if you use css custom vars, there's even no delay because of compiling time.

"Naming classes is hard"
So what do they call their javascript functions or the like? a() b() wtf()?

"seperation of concern"
As @peerreynders nailed it. Concerns ar not features but content, markup, styling and functionality.

"I don't need to switch context"
So switching tabs in i.e. vscode is a context switch then?

"I can rapidly code my MVP"
But what about the project in the long term? What about maintenance?
Even in times of using components stylings may may get out of sync.

"the cascade"
You lose the power css gives you. You can style a very component, even with breakpoints and hover. But can you style by context?

.category-a .btn { background-color: red; }
.category-b .btn { background-color: green; }
Enter fullscreen mode Exit fullscreen mode

or

.name-input + .btn { width: 100%; }
Enter fullscreen mode Exit fullscreen mode

I'm really willing to give it a try, as I see the benefit for non-css devs in my teams, so I try to be as open as possible. But until now the "utility first" approach is not my thing.