News for hackers. Stuff that matters.
Re:What working with Tailwind CSS every day for 2 years look... by onion2k on Tuesday November 29, 2022 @12:06PM (#33790165)
It's loved by novices and those who don't know what they're doing, almost exclusively.

I've been a frontend dev for 25 years and I quite like Tailwind. I'm not sure which category I fit into. I think it might be both.

Replacing `p-4` with `p-4` will require you to replace its occurrence all over your app, sometimes affecting thousands of matches.

This is a really good example of where Tailwind is actually quite nice. Imagine if you didn't use a utility class, and instead you'd written your styles in plain old CSS or SCSS with "padding: 8px;" everywhere on your years-old-built-up-to-thousands-of-styles design. Replacing those is easy enough, but what about your SCSS mixins? Your CSS calc()s? The places where someone thought an element needed a bit more padding and used "padding: 9px" instead? Manually managing styles is hard. Tailwind makes it a bit easier, mainly because it encourages consistency and removes variability. Finding and replacing a "p-4" everywhere is trivial, and if you've used a library well rather than rolling out an ad hoc mix of things you can be quite confident your change will work everywhere. It's far from perfect but it's quite a well-thought out approach.

Re:What working with Tailwind CSS every day for 2 years look... by kypro on Tuesday November 29, 2022 @01:00PM (#33790895)
Variables would be the obvious answer here.

If you're applying `p-4` to all your component classes you're only marginally improving on applying `padding: 8px` on all of your component styles. Both are terrible solutions even if one is slightly better than the other.

I generally agree with OP. Tailwind is horrible for larger projects and I have no idea why it's so well liked. The utility class approach is bad, and naming of their utility classes is even worse.

For smaller projects or for prototyping it's okay, although even then it's only slightly better than inlining styles.

Re:What working with Tailwind CSS every day for 2 years look... by 9dev on Tuesday November 29, 2022 @01:17PM (#33791110)
But p-4 is a variable: you can set the actual padding applied in the configuration file! It doesn’t have to mean 8px, but rather „standard amount of padding“. If you want to use „small amount of padding later on, you’ll use p-2 - whatever that means in your app.

That solves the exact problem you and OP complain about, in a neat, configurable, safely replaceable way. Tailwind allows you to separate design intent from implementation values.

Re:What working with Tailwind CSS every day for 2 years look... by waboremo on Tuesday November 29, 2022 @01:24PM (#33791196)
Vanilla CSS also allows this, without any real effort either. Tailwind's power is in its defaults, as soon as you want to start tinkering, you were much better suited sticking to vanilla CSS.
Re:What working with Tailwind CSS every day for 2 years look... by 9dev on Tuesday November 29, 2022 @01:44PM (#33791461)
I didn’t dispute that. I just refuted parents point here.
Re:What working with Tailwind CSS every day for 2 years look... by onion2k on Tuesday November 29, 2022 @04:43PM (#33793761)
Variables would be the obvious answer here.

Variables are very cool and super powerful, but they fall down if you need to support old browsers and it's really easy to make things that are hard to reason about (defined in several places, used in calc()s, overridden in the cascade, etc). On a team that doesn't communicate or test well vars can be a source of pain.

Re:What working with Tailwind CSS every day for 2 years look... by diob on Tuesday November 29, 2022 @01:14PM (#33791071)
They "No true Scotsman" started their argument, so I think you're fighting uphill.

I have around 10 years experience, tailwind is a godsend for maintainability and speed.