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

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