Live data from Hacker News

Tailwind is a leaky abstraction

jakelazaroff.com

311–320 of 391 posts

Re: Tailwind is a leaky abstraction

#311
post #6

Tailwind has made building components in React an absolute joy for me. I don't need to scroll up to find my css-in-js definitions, I don't need to change windows to find the CSS modules, it's all there, in one place.

You could get the same benefits by using the `style` property though. The good part of tailwind is the part where it's all compiled down so it's not unnecessarily verbose in the HTML served to the client.

Re: Tailwind is a leaky abstraction

#312
post #246

Earlier quoted context omitted.

But now you just have a single-use html+stylesheet, as I wrote. No separation of concern anywhere, and both html and css can only be written by knowing the other part.

Why is the stylesheet single use? The classes can be used anywhere, as they should be. Make components in the CSS and call them by their classname in HTML. You are building generic components here. I don't see the issue with 'separate files', do people not use split view mode in their IDE? edit- this comment in another thread: https://news.ycombinator.com/item?id=33789859

But you aren't building a generic product. You are building something specific.

I'm my experience the _vast_ majority of CSS never gets reused. Sure if all you are building is marketing websites or landing pages then I suppose some generic "cards" or whatever will get you pretty far, but for anything even moderately more complex... no chance

Re: Tailwind is a leaky abstraction

#313
CSS is a leaky abstraction - it's declarative programming with none of the power of actual programming. Basically the most unpleasant API I have ever used. I find it hard to care if the latest framework is a leaky abstraction for CSS. There's a constant translation between 'sane, decent mental models of layout' and 'real CSS' anyway.

Re: Tailwind is a leaky abstraction

#314
post #311
post #6

Tailwind has made building components in React an absolute joy for me. I don't need to scroll up to find my css-in-js definitions, I don't need to change windows to find the CSS modules, it's all there, in one place.

You could get the same benefits by using the `style` property though. The good part of tailwind is the part where it's all compiled down so it's not unnecessarily verbose in the HTML served to the client.

Hover effects and breakpoints aren’t possible (as far as I know) with style attributes, though.

Re: Tailwind is a leaky abstraction

#315
post #69
post #6

Tailwind has made building components in React an absolute joy for me. I don't need to scroll up to find my css-in-js definitions, I don't need to change windows to find the CSS modules, it's all there, in one place.

But you still have to have a config file, right? And the Tailwind docs. And then keeping track of when you changed something in your config that means the docs don’t apply 100%.

I’ve touched my tailwind config file a handful of times in two years. It’s not a problem. Tailwind just gets out of my way and let’s me iterate quickly without worrying about global side effects that always happened in other projects. I love it.

Re: Tailwind is a leaky abstraction

#317
I feel I’m the only one rolling my TW keywords into classes when they get too unwieldy. It’s against the recommendations of TW and anyone, but it works much better than creating a new component for absolutely every tiny thing.

Eg .Btn for a bunch of styles that style a button element, then .Btn .—-large to make it large, etc, which uses more TW styles in my scss file to make it work. It saves me a ton of time and allows me to use the same template across many projects; if a color needs to change or sizes are different t I swap it out with css vars

Re: Tailwind is a leaky abstraction

#320
post #253

Earlier quoted context omitted.

I've looked at tailwind as an individual, but their pay-for-documentation model is absolutely bullshit. And it doesn't seem to be doing anything different from Bootstrap or 99% of the other CSS frameworks out there. Also, it makes me sad to see people so eager to throw away separation of concerns :( Yes everything describing it is on one screen but now your HTML is filled up with hundreds of words of awful classnames…

Separation of concerns went out of the window a long time ago when frameworks (i.e. React) showed that it's better to combine business logic + markup into a neat encapsulated package. Having a neatly encapsulated component that does everything is fine in most setups. Your main challenge will be not growing these components too big. (( I really dislike Tailwind btw, mostly because I am just translating CSS into someth…

that's the power of functional cohesion
Post reply on HN