Live data from Hacker News

Tailwind: A Utility-First CSS Framework

tailwindcss.com

81–90 of 106 posts

Re: Tailwind: A Utility-First CSS Framework

#81

How is tailwind different than Atomic CSS? https://acss.io Small utility classes without writing CSS, seems like the same thing. Disclaimer: I worked with the devs that created it.

From adamwathan's article, Tailwind's advantage is it limits you to fewer choices. So .text-grey .text-grey-dark .text-grey-darker .text-grey-darkest... rather than coming up with and remembering the hex color values, which might vary between team members.

Re: Tailwind: A Utility-First CSS Framework

#82
post #58
post #51

Earlier quoted context omitted.

I mean a lot of those things were possible with bootstrap-sass years ago. > Define the essence of your design in a JSON - typography, colors, spacings, shadows, borders et al. _variables.sass > Anyone in the team including backend developers can create new interface components without waiting on a designer, thanks to well-defined scales that compose well. This is true, but is solved by any sort of component system an…

_variables.sass works if you're using BEM. But now you have two component-like things: BEM classes, and the components themselves. BEM solves the issues inherent in nested CSS (cascade, inheritance, multiple selectors, specificity) by forcing us to never nest them, and instead having to name every single element in HTML. Though they look semantic, they are not truly reusable since they are coupled deeply with the mar…

BEM?

Re: Tailwind: A Utility-First CSS Framework

#83
post #68

What's the difference between tailwind and tachyons?

You can generate tachyons from tailwind

Okay now I get it. That's neat. I'm using tachyons but this approach is compelling.

For what it's worth, I don't think "What is Tailwind?" makes that clear (the "designed to be customized" section hints at it) and I had to read https://tailwindcss.com/docs/configuration to understand the difference after reading your comment. Thanks!

Re: Tailwind: A Utility-First CSS Framework

#84
post #36

Earlier quoted context omitted.

Generally you’d have your button html and classes inside a component so you’re just tweaking that one component.

Then it feels like we're just back to writing normal CSS classes.

Buttons are sort of a pathological example. Most components in a web app are container-like things, with collections of a couple of buttons and other things that need to have a cohesive look, internal and external positioning, etc. And how often do you end up with one large, crufty CSS class for each of those, or a handful that are closely tied to each other and the markup anyway? Frameworks like this allow you to easily move that gunk from the CSS to the HTML.

Re: Tailwind: A Utility-First CSS Framework

#85
post #82
post #58

Earlier quoted context omitted.

_variables.sass works if you're using BEM. But now you have two component-like things: BEM classes, and the components themselves. BEM solves the issues inherent in nested CSS (cascade, inheritance, multiple selectors, specificity) by forcing us to never nest them, and instead having to name every single element in HTML. Though they look semantic, they are not truly reusable since they are coupled deeply with the mar…

BEM?

BEM — Block Element Modifier is a methodology that helps you to create reusable components and code sharing in front-end development

http://getbem.com/introduction/

In short, you do things like this:

.form { }

.form--theme-xmas { }

.form--simple { }

.form__input { }

.form__submit { }

.form__submit--disabled { }

Where the prefix __ is an Element and -- is a Modifier.

So, in that example you have the form, the form with Christmas modifier and also a form button that is expected to only happen under forms.

Re: Tailwind: A Utility-First CSS Framework

#86
post #76

Earlier quoted context omitted.

You make interesting points. For me, as a back-end developer, the prevalence of Bootstrap is a major con because I can't (due to lack of knowledge or confidence, I'm not sure) make a Bootstrap site look like anything other than a Bootstrap site with different colors. Tailwind is the first front-end framework that successfully got me away from that and helped me execute own unique design vision. What seems to come to…

For websites where having a unique design is not a requirement or a priority, Bootstrap and similar frameworks are very helpful.

Don't disagree with this at all. Bootstrap, like Tailwind, is a tool and after I purchased a cordless drill I didn't go around telling everybody I know to throw out their manual screwdrivers because the revolution has arrived. It seems to me that's what people perceive is happening here.

Re: Tailwind: A Utility-First CSS Framework

#88
I do see the 'utility'(!) of this kind of approach to css, but have a main issue on responsiveness. Yes, the solution commonly touted is to define global breakpoints: 'small' 'large', etc. But for me defining those globally is too narrow. Sometimes different groups of components need to respond differently, with context. More worryingly, soon we'll move to 'element' queries, which should suit better than screen-based media queries. We'll be able to say 'when this component is squeezed down to < 500px wide, then wrap the second element underneath the first. That approach is more compatible with modern component architecture. But I don't see a context-specific or even component-specific solution immediately with this framework.

Re: Tailwind: A Utility-First CSS Framework

#89
post #66

Earlier quoted context omitted.

To be fair, you can do that with SASS variables too and is not unique to Tailwind.

I've not seen people encouraging variables called $white, because that's pretty short sighted. It seems to be encourages with utility css

That’s incorrect. What your missing is that in the config file you define a new color; say ‘rose’ and then the framework auto provides bg-rose, text-rose, border-rose, cutting duplication and bringing consistency.

I think the big shift started to happen when people started to say, let’s treat CSS like code and what would we expect of good code, and then all of these CSS Sacred Cows were then seen in a new light. The biggest of them all for me was ‘naming things are hard’, traditional CSS implies naming your classes is easy, and for a once off example it is always easy, but that approach is a lifetime commmitmnet to generating names on names just to add styles and this adds a naming things complexity burden that until recently has just been a generally unacknowleged invisible cost.

Re: Tailwind: A Utility-First CSS Framework

#90
post #23
post #11

It is convenient but you are not separating markup and presentation. I think the whole point of css is to swap stylesheets and get a different presentation, like demostrated by http://www.csszengarden.com/ BEM/OOCSS lets you do this.

How many times you do that in real project? Or have you ever done that in your career? And if a project needs substantial redesign it is usually acompanied by the functionality change, which means you need defferent html/components too, so you still can`t just swap css files.

[deleted]
Post reply on HN