by methodical · 3y ago · 0 comments
To not leave this comment with simply a hand-waving disregard of this post, let me say this: Nobody who knows what they are doing writes Tailwind styles as long as the ones presented in this post, nobody uses arbitrary styles or custom styles as many times as is presented in this post, and yes (in a shock to nobody)- it is quicker to write "m-2" than write ".[my unique, non conflicting class name (usually incredibly arbitrary to avoid conflicts)]{ margin: 10px };" and then implement that in code. Usually, when you try to write pure CSS efficiently, you just end up basically duplicating Tailwind by creating utility classes anyways, except minus all of the actual perks of JIT.
At this point in time, if you say that you see no benefit in using Tailwind, you are being obtuse.
I truly mean no disrespect by this, but have you considered that other people might be better than you at writing CSS? Because what you are describing is absolutely not a universal experience.
Anyway, here's one common scenario for me: I need the same set of styles on multiple elements. With Tailwind, it goes one of a few ways:
- I duplicate the styles on all of the elements
- I abstract the data into some sort of loop and add the styles to the single element in the loop body
- I create a component, add the styles to that component and use that in place of each element
All of the above gets harder if there are existing elements that share some of the same styles, because I now need to identify the subset of styles that must be extracted. It's even worse if it happens across different tag names, because I then need to introduce branching into my abstraction.
Meanwhile, with CSS, I just give each element the same class name and add those styles to that class name.
I think this is what the author is getting at by saying Tailwind is far to the "write-only" side of the spectrum. There's no argument from me that just writing `m-2` is faster than adding a class name to the element, going to my CSS file and writing `.classname { margin: 0.5rem; }`. But that's only the first part of the process.
Maintaining and debugging code (yes even styling) takes much more time than writing it in the first place. Which is why readability is so important, and why Tailwind's approach of big unreadable blobs is so jarring (it doesn't just make the styling hard to read, it also makes the surrounding markup hard to read).
That sounds a lot like no-true-scotsman.
The big image of the overstyled checkbox is from Netlify's admin dashboard.
You literally defended CSS in a similar way in your post "The cascade, selector chaining (see above), and specificity are all very powerful tools. If you misunderstand them, yeah you can cut yourself. Just like if you don't use a saw properly you can cut yourself.". In the same sense, just because some people write super long Tailwind classes doesn't mean that you can extrapolate that to all Tailwind classes.
> Whenever I see someone make such a statement, I can tell it's more of a propaganda piece than a piece meant to spawn logical thought.
come across as pretty absurd. on whose behalf is the author supposedly writing said propaganda for? Big CSS? the guerilla antitailwindist movement?
the irony is you accuse the author of being emotionally biased, yet claim objectivity yourself, while defending said supposed objectivity with language that is far from dispassionate. this may resonate with other tailwind enthusiasts like yourself, but to the outside observer who has no investment (emotional or otherwise) in being either for or against tailwind, it comes across as far more overemotional (to the point of mild absurdity) than the author did in TFA.
this ends up having the opposite of what I must presume to be your intended outcome: it leads to the outside observer, reading these comments with mild interest to determine whether or not tailwind is perhaps worth another look since they checked it out last time, to be dissuaded from investigating this tool you like to use any further.