Hacker News new | ask | show | jobs
by geek_at 878 days ago
Especially in the HTMX community I'm alwayws wondering why people are chosing Tailwind. I tried it too and had the same problems as stated in the article.

Mainly that its polluting the HTML so much. I went the opposite route and am using PicoCSS now which works with semantic tags and can even work without any classes. Feels much cleaner

1 comments

Locality of Behaviour:

"The behaviour of a unit of code should be as obvious as possible by looking only at that unit of code"

https://htmx.org/essays/locality-of-behaviour/

Some people want "cleaner" and that's fine, I much prefer things to be "right there" as much as possible. Must be how my brain works

Unfortunately it’s a little more complicated than locality of behavior because there is a trade off with duplication and consistency of behavior
Well sure, you can make anything as complicated as you want it to be
CSS is not behavior, but styling. Styling should be independent of behavior.
It shouldn't, and it has never been independent of behavior. The original pipe dream of CSS is not the only separation of concerns that exists: https://twitter.com/simonswiss/status/1664736786671869952
> It shouldn't

Changing a theme shouldn't affect behavior (by default).

CSS isn't (just) about theming, and hasn't been since forever.
Also known as spaghetti code.
Spaghetti-ness is orthogonal to locality. You can have a clean god object, or a tangled abstraction. In my experience, neither invites spaghetti-ness more than the other. With less abstract code, you have less abstract spaghetti, and with more abstract code, you have more abstract spaghetti. And you can do both cleanly as well.
This - the burden of affixing and naming the hundreds of pieces of composite styling consisting of 30+ tailwind classes is fully moved to the poor guy who needs to read, grok and maintain the code that the original author was too lazy to care about.
Spaghetti would imply tangled surely? Tailwind is verbose but it’s the opposite of tangled