5 ms·
Isn't this true of any code though? How is CSS class naming any different than the naming of types and functions? It's easier to read and understand because i
by wvenable 6y ago
Isn't this true of any code though? How is CSS class naming any different than the naming of types and functions? It's easier to read and understand because it's an abstraction.
Something like...
<div class="button button-primary">
...isn't going to confuse anyone. I believe tailwind is hard to read because it's basically just inlining everything tersely with very little abstraction at all.
- corytheboyd 6y agoIt’s more about using established and documented systems vs creating new ones (where you probably don’t have documentation). Even if you do have a home grown solution that is as well documented as tailwind, you are still at a loss because nobody will be familiar with it already.
- wvenable 6y agoYeah I disagree with this. The point of writing code is create new systems. We have literally dozens of applications at my company all with the same look and feel. We, of course, created a new system that defines that look and feel. Just like we create classes, and methods, and components to maintain that. Ignoring the power of CSS to abstract style is a waste of it's potential. Now that's not to say we don't use established libraries for CSS. But we definitely add our classes and add our customization.
- corytheboyd 6y agoI don’t mean to never create systems, I never said that, did it come across as me implying this? To explicit state my intent, it’s that you should strive to create as few new systems as necessary, but you’re very obviously going to need to create SOMETHING...?
- wvenable 6y agoI guess I don't understand your reply. This is a critique of tailwind and the best you can say about it is that it's an existing documented system somebody else might know? I love standards, there are so many to choose from, but on the face of it tailwind doesn't seem like the best standard to choose. In places where I might find tailwind appropriate, I could use just the even more common standard of bare CSS properties.
- corytheboyd 6y agoIt's okay to agree to disagree haha, at the end of the day what works best for you personally is what you should use!
- graydsl 6y agoYeah but that is the easiest example imaginable. The problem is not a button class its the card-left-wrapper-container class that you have to use to style something the right way. It basically boils down to naming things for me. The author says it's a good thing. I don't think so. Most of the time in plain CSS we have to come up with arbitrary names, that introduce confusion and bugs later on. Utility classes, while sometimes cumbersome to read, always state their intent.
- wvenable 6y agoWhat's the tailwind equivalent of `card-left-wrapper-container`? I imagine it's 200 characters wide. Based on the name I'm going to assume that the class is used on container for a layout with cards on the left. Utility classes don't state their intent they state their literal contents. If the intent is to be a button or be a wrapper-container then that's in a well conceived class name. > Most of the time in plain CSS we have to come up with arbitrary names, that introduce confusion and bugs later on. If the names are arbitrary then of course have problems! If you code and made up arbitrary names for functions you'd also have problems. The point of the name is to add clarity and abstract out details I don't need to know. I don't need to know that buttons have a certain padding, margin, etc when I'm placing them on a form. And I don't need to know everywhere they are placed when I style them.
- Zancarius 6y agoYou can create components by aggregating the utility classes in tailwind. In fact, the documentation recommends this approach for production[1]. So if you want your "button" class, you can have your "button" class. The reason tailwindcss has so many proponents is arguably because of its compositional design, but it's paradoxically not one of the first things people seem to talk about when they're discussing tailwind. They fixate on its utility-first design. I think this does it a significant disservice. No, I don't know why. I'm not a designer. [1] https://tailwindcss.com/docs/extracting-components https://tailwindcss.com/docs/extracting-components
- fragile_frogs 6y ago