Live data from Hacker News

TailwindCSS v2.0

blog.tailwindcss.com

471–474 of 474 posts

Re: TailwindCSS v2.0

#471

Earlier quoted context omitted.

It's not like Tailwind is SAP or something. It's just CSS. You shouldn't need to re-work your entire process around it. The custom stuff in our config was mostly the need to create standard styles for components. Eg. button large, button small, etc. to correspond with our design system. For example, here's tailwind code required to create a button large: bg-violet-100 text-violet-700 text-base font-semibold px-6 py-2…

If you are using Tailwind then your designers need to be aware of its presets and be designing with them in mind. When it comes to code reuse, either extract the button to a component that you reuse, or extract it to a class in tailwind. .btn { @apply px-4 py-2 rounded } Now you can just add the btn class and you’re done. If you ever want to change that button you can just update it and be done. If you want a button…

On the surface Tailwind seems quite great and whenever I stumble upon it I like the idea of good defaults, but since I don't use React or a component-based UI framework I'd mostly work with Tailwind's @apply directive, I assume, and at that point I wonder why I shouldn't simply stick to

    .btn { padding: 4rem 2rem; border-radius: 2rem; }
rather than

    .btn { @apply px-4 py-2 rounded }


It simply feels like an additional, unnecessary layer and, frankly, somewhat wrong.

Re: TailwindCSS v2.0

#472

I don't do front end dev, and haven't for a very long time, but can someone help me understand how this doesn't lead to inflexible hard to maintain soup? Just to take colours, for a moment. Ordinarily I might define semantic classes, let's say "primary-nav" or "prominent-action" and apply them to relevant things (and use relative selectors for things inside them, etc.). So if I want to change the colour of all promin…

> can someone help me understand how this doesn't lead to inflexible hard to maintain soup? It most likely does, but it's not old and popular enough for people to have accumulated enough technical debt within systems built with it.

My thoughts exactly.

Re: TailwindCSS v2.0

#473
post #456
post #384

Earlier quoted context omitted.

There's another approach that is more rooted into react paradigm - styled-components. I still don't understand what people see in tailwind as most of the arguments I see in this thread could also be applied to it, but you also get type-checking (typescript), theming, ecosystem of plugins and a lot of other cool things.

I agree that styled-components takes care of a bunch of issues that make some of us reach for Tailwind. However, aside from requiring a very specific tech stack, it doesn't solve the problem of every component potentially having slightly differing styles. There's ways to handle this, but one thing I like about Tailwind is that the defaults are stronger across components, while still leaving space to deal with all the…

I believe in some environments (when you have designs already) building off normalize+react-aria(for logic) and thought-out architecture could be as productive as tailwind, especially if you already have some helper functions on-hand. For me, storing mixins for common behaviours inside theme allows to construct lightweight variations where I need them, and you can dynamically modify it in react.

Re: TailwindCSS v2.0

#474
post #368

Earlier quoted context omitted.

> It's not like Tailwind is SAP or something. It's just CSS. You shouldn't need to re-work your entire process around it. No, your designers should already be working to scales for size, colour etc. which you can implement in Tailwind. If they don't, now's a good time to start. > How the hell does that help with consistency? You have to copy paste that mess every time you create a new button You're extremely not supp…

> with your JavaScript component framework If I’m using React components, tailwind makes even less sense. I’ve already separated my button large out as a component, guess what happens in a mature design system? The system gets updated and changed to fit the needs of the product. So what happens when you need to change button large in tailwind? You need to restyle the button with the spaghetti mess (maybe add somethin…

CSS is difficult. First start with content. Then add semantic markup. Only add classes if you really need to. Try to avoid div and span.
Post reply on HN