Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What I’m arguing about is that composition isn’t necessary in most cases. Because all components evolve independently. Also nesting is syntactic sugar, nice, but orthogonal to these discussions. And scoping is done with selectors.

CSS isn’t an imperative language. It’s a declarative one. And what’s most important is understanding what it is trying to solve (mostly not styling elements with tag’s style). Which is what Tailwind is replicating.

Tailwind may help you in some cases, but not because of a defect in CSS. It’s like using an ORM, then past a certain treshold, you find yourself doing (badly) SQL but in $language.



> Also nesting is syntactic sugar, nice, but orthogonal to these discussions.

What is it with you and nesting? We were talking about scoping styles to a component.

> CSS isn’t an imperative language. It’s a declarative one.

So what? Doesn't mean you can't provide nice declarative ways of doing things. Like SASS has provided for 20+ years.

> Which is what Tailwind is replicating.

I fail to see the logic or, indeed, the meaning of your assertion.


> What is it with you and nesting? We were talking about scoping styles to a component.

I get where you coming for. But the issue that the scoping[0] you're referring to on your other comment is something I've never encountered or heard someone complain about.

In my mental model, an element owns it subtree in terms of styling. Meaning that, if I a component can be placed either statically or dynamically, then it belongs to all the elements that may be its parent. And if it want independent styles, then I reset it at the root of the component. So I assumes, any style property that is not set at the root of any element is inherited from the parent.

No need for elaborate syntax and mechanisms that just drive up the complexity of the code.

[0]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_scoping


> But the issue that the scoping[0] you're referring to on your other comment is something I've never encountered or heard someone complain about.

Why do you think BEM exists? Or CSS-inJS? Why do you think web components exist?

All these are attempts to actually do what you claim css is already doing: to make sure that the element owns its subtree in terms of styling.

CSS is global.

> So I assumes, any style property that is not set at the root of any element is inherited from the parent.

Of course not. The hint is in the name: Cascading stylesheets. Your "owned" subtree is owned by every single element above up to and including document root.

> No need for elaborate syntax and mechanisms that just drive up the complexity of the code.

There's nothing complex about Tailwind. It actually reduces all the complexity to a set of small primitives. And since it's still CSS, you can write your own CSS as you wish.

Here's a good overview of how and why you would use it: https://piccalil.li/blog/cube-css/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: