5 ms·
Tell us a bit more about Tailwind. Last I looked at it a few years ago it seemed a conglomeration of antipatterns. Quick googling is not convincing. Assume tha
by dotancohen 4y ago
Tell us a bit more about Tailwind. Last I looked at it a few years ago it seemed a conglomeration of antipatterns. Quick googling is not convincing.
Assume that I know _nothing_ about Tailwind, sell it to me. I'd appreciate it. Thanks.
- deergomoo 4y agoThe author of Tailwind wrote a blog post explaining his rationale just after the very first version was released: https://adamwathan.me/css-utility-classes-and-separation-of-concerns/ https://adamwathan.me/css-utility-classes-and-separation-of-... It may be a longer read than you were looking for, in which case I’d say just try it on a small project next time you get the chance. It looks like it wouldn’t work, but it really does.
- christophilus 4y agoBeen developing websites and apps since the days when we are worrying about the y2k bug. Tailwind is my favorite thing. Almost everything that I disliked about CSS is solved by it. Once you really kick the tires, you become way more productive: Naming is hard. No more naming. Switching between your markup and your CSS added friction to your flow. No more friction. Avoiding problems caused by overly aggressive rules / cascade/ whatever is mostly a thing of the past. I could go on, but if it’s not obvious, I absolutely love it. And the Tailwind UI project is 100% money we’ll spent, too.
- danielvaughn 4y agoI feel the same way about Tailwind, but haven't taken the plunge on Tailwind UI. Though I kinda want to buy it just to support the team. Do you feel like it constrains you too much, or no?
- pbowyer 4y ago> Though I kinda want to buy it just to support the team. That's kind but they have earned shedloads already (over $2m USD as of Jan 2021 [1]). That's on top of the $2.3m for the Refactoring UI ebook [2]. 1. https://www.smalltechbusiness.com/monetizing-open-source-tailwind/ https://www.smalltechbusiness.com/monetizing-open-source-tai... 2. https://twitter.com/adamwathan/status/1289702466754211842 https://twitter.com/adamwathan/status/1289702466754211842
- danielvaughn 4y agoHa, fair enough. Though now I'm aware of the book and kinda want to buy it :p
- christophilus 4y agoI don’t use anything other than the design ideas. When I’m building a feature, the first thing I do is find a design pattern from Tailwind UI. For that, it’s been well worth the few hundred bucks.
- vehemenz 4y agoSince you use the term "antipattern," what is the respectable pattern (methodology) that Tailwind stands opposed to?
- rafram 4y agoSemantic classes.
- vehemenz 4y agoHow is a class with a single rule, that does exactly what it's supposed to, not "semantic?" What do you think "semantic" means, in this context? Maybe you mean classes organized with a high level of abstraction that have multiple rules and are meant to be related to the document structure in a specific way?
- ehnto 4y agoThey might mean a system like BEM, where they are semantic in that they represent concepts tightly coupled to the HTML and what it's used for. <div class="product"> <button class="product__add-to-cart"> ...etc BEM is a good example of what Tailwind is a counterpoint to.
- e12e 4y agoNothing stops you from layering BEM on top of tailwind via @apply - although I'm not sure if that's a good idea. Maybe if creating a full, custom, design-system using tailwind?
- omnimus 4y agoAlthough the Tailwind author hates @apply and says they shouldn't have put it in the tailwind in the first place (mainly because it's a hard feature to develop - i wouldn't be surprised it would be removed). I think going tailwind only is bad too because you loose many of the nice functions of CSS like theming/cascade. So i think using utility classes/tailwind for base/layout and still using named classes where it makes sense (like common reusable components, hover hiearchies, transitions/animations) is most practical approach. And using BEM as convention for the named classes is not a bad idea - certainly better than no system.
- norman784 4y agoAside from was being said, for me, at least when developing component based app, it the better choice IMHO, most css classes contains just one css rule, so you when reading your component class already can visualize how the component looks like. If you are developing a old school web, I would say it could be a pain if you mid project want to change the style of one element (because you are not using components) you need to find and replace every occurrence of the elements classes. Also not to mention, you skip all the nonsense of the CSS in JS and the need of tools to extract the CSS from JS. Also other big win is that you can use with other projects not based on JS, I'm toying with a WASM app and use tailwind without issues, just run the tailwind bin on my app change (takes a second or less to generate the css file), the only downside here is the need of nodejs (you might be able to download the binary directly and run that, like I do on CI).
- danielvaughn 4y agoI hated the idea of Tailwind when I first saw it. Decided on a whim last year to give it a solid try after hearing others say "you just have to experience it for yourself". I tried it, and now it's literally painful going back to anything else. I can't explain it, it's just magical. In my opinion, Tailwind is to CSS what jQuery was to Javascript. It's just the right level of abstraction that you need. But you have to just try it for yourself and experience it. I'd recommend using it with VSCode's intellisense plugin.
- FractalHQ 4y agoMakes CSS faster to write in the short term, and harder to read in the long term. Also makes complex markup abysmally dense and unwieldy. I understand why people like it but I avoid it when I can. As a Svelte user, my markup is sacred and each component has an automatically scoped style tag so Tailwind is an anti-pattern in any non-trivial project.
- e12e 4y ago> Assume that I know _nothing_ about Tailwind, sell it to me. I'd appreciate it. Thanks. Tailwind removes (or wilfully ignores) the "cascading" from css. It breaks all good, old css design patterns on purpose - in favor of "widget-level" styling. It also effectivly builds its own (extendable) style language via named classes, ending up somewhere between "semantic" and "micro-styling" - but allowing for refactoring as needed. It reduces CSS to an implementation detail. For example, in "Agile Web Development With Rails 7"[1], a number of form fields are initially styled as: ... class="block shadow rounded-md border border-green-400 outline-none px-3 py-2 mt-2 w-full " Later reactored to: ... class="input-field" via tailwind: .input-field { @apply block shadow rounded-md border border-green-400 outline-none px-3 py-2 mt-2 w-full } On the surface similar to defining a css class - but effectively scoped to your own code. In a small project, where you're publishing documents - tailwind might not be great - but in a large project, with many widgets it is a good fit. Similar to how "movable code" (js on the client) might be a better fit than REST for web applications (as opposed to web pages). [1] https://pragprog.com/titles/rails7/agile-web-development-with-rails-7/ https://pragprog.com/titles/rails7/agile-web-development-wit...