Comment by azangru
1 day ago
Do you remember what made it click for you? What was the hard part of writing plain CSS that tailwind made significantly easier?
1 day ago
Do you remember what made it click for you? What was the hard part of writing plain CSS that tailwind made significantly easier?
CSS requires discipline, or you end up accidentally styling something completely unrelated because you were overly general, or overly specific, or accidentally reused a class name. CSS disallows local reasoning. If you’re writing markup for a component, you have to jump between two files.
There are plenty of other problems Tailwind solves, but these two alone make me never want to go back.
Ignoring that Tailwind requires that same discipline... Pay close attention how often you end up in a situation where a different color was used, or how dark theme tags have been missing, and so much more.
What if you need to copy a element with tailwind, this later gets altered to include a slightly different style, but wait, now you have a original somewhere else in your code base, that is missing those updates. So you require the discipline just like CSS to keep things up to date.
Tailwind is great if you use it sporadically ... but have you looked at the source code of so many websites that use tailwind? Often their entire html file is a horrible mess million miles long tags.
I am amazed how often people do not even realizes that CSS supports nested Selectors? With nested Selectors, you get the benefit of creating actual component level structures, that can be isolated and shareable. Yet almost nobody uses them. I noticed that most people lack a lot of CSS knowledge, and they find it hard because they never stepped beyond the basics. Nor do they keep up to date.
> What if you need to copy a element with tailwind, this later gets altered to include a slightly different style, but wait, now you have a original somewhere else in your code base, that is missing those updates. So you require the discipline just like CSS to keep things up to date.
You solve these problems by creating abstractions in JavaScript (most likely react components), exactly the same way you'd solve any other sort of code duplication.
By using tailwind (or inline styles), you go from two system of abstraction (CSS, JavaScript) to one (just JavaScript).
1 reply →
The situation you describe is one of the most maddening things about tailwind, and what leads to most of it being write only code, in my opinion
I agree with you about discipline; but... was it not interesting to discover how to build such a discipline? Was it not intriguing to learn how people who had been writing CSS for years had made it tolerable?
Besides, there recently have been several crucial improvements to CSS to address these pain points. One is CSS layers, which lets define custom layers of specificity that help with the discipline (e.g. resets or some baseline styles go in a low layer, component styles go in a higher layer, and finally overrides end up in the highest layer). The other is CSS scope, which prevents the leakage of the styles. These should greatly help with the specificity issues; and @layer is now sufficiently broadly supported that it is safe to use.
> If you’re writing markup for a component, you have to jump between two files.
Yeah; one of the reasons for my question about the groups in which tailwind saw the biggest growth was that in some ecosystems jumping between files was not a problem to begin with. Vue, for instance, had single-file components, where css could be written in the same file as javascript. So did svelte. So does astro.
> was it not interesting to discover how to build such a discipline? Was it not intriguing to learn how people who had been writing CSS for years had made it tolerable?
As someone who writes tiny amounts of CSS these days (having known it reasonably in the late 90s and early 2000s with all the hacks and IE related bullshit), I have _zero_ interest in it.
If I'm doing it, it's only because there's no serious cross-platform equivalent to Windows Forms to power small experiments, and curiosity is certainly not there to improve the experience.
I’ve been building web sites and applications since 2000. I’ve done just about everything you can imagine SCSS, BEM, whatever. Tailwind is the best thing I’ve seen in that time.
We can agree to disagree about that, and that’s OK.
I should note that other than Clojure, I absolutely hate dynamically typed languages. I suspect (though dunno how to prove it) that folks who like Tailwind probably like statically typed systems and maybe functional programming- it seems to fit into that philosophical niche. And probably people who like vanilla CSS are in a different category.
I’d love to hear from both camps to find out whether or not that tracks.
1 reply →
This is why I loved polymer 1 and it's adoption of the shadow dom.