W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2018

Re: [csswg-drafts] [css-nesting] Conflicts in proposal with Sass/Less

From: Matthew Dean via GitHub <sysbot+gh@w3.org>
Date: Wed, 18 Jul 2018 15:14:26 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-405967357-1531926865-sysbot+gh@w3.org>
One second thought, I _do_ have a proposal. I've been tinkering with a styling language that avoids the problem of `&` littered all over the place by doing an implicit `&`, and requiring any nesting to use explicit combinators. Descendent combinators require the explicit symbol.

As in:
```less
.component {
  :hover {} // .component:hover
  .modifier{} // .component.modifier
  > .child, >> .grandchild {} // .component > .child, .component .grandchild
  + .component {} // .component + .component
}
```
This doesn't address placing the inherited / parent selector after the nested selector, but is that very CSS-y anyway? That's certainly not how the nested `@media` proposal works. IMO nesting should work similar to nested `@media`, where it appends a new condition. Adding a placeholder of where to append doesn't really make sense for CSS.

It also doesn't necessarily solve at all how Sass/Less would produce the above output, but at least it avoids entirely the semantic confusion of borrowing `&` from those languages.

-- 
GitHub Notification of comment by matthew-dean
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2937#issuecomment-405967357 using your GitHub account
Received on Wednesday, 18 July 2018 15:14:34 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:26:51 UTC