[csswg-drafts] [css-nesting] Syntax suggestion (#4748)

proimage has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-nesting] Syntax suggestion ==
_This is kind of a follow-on from the closed issue #2701 and #2937._

Would it make any sense to implement native CSS nesting something like this?

```css
body {
    background: black;
    color: white;
    ( /* note the open parentheses to indicate everything within is nested */
        main {
            background: orange;
            color: black;
        }
        p {
            font: serif;
        }
    ) /* close parentheses */
}
```

Or perhaps even like this (uses existing parser patterns):

```css
body {
    background: black;
    color: white;
    @nest { /* or @nested, or @child, etc */
        main {
            background: orange;
            color: black;
        }
        p {
            font: serif;
        }
    } /* END NEST */
}
```

Basically, it would require any nesting to be placed within a separate grouping container, as a way to differentiate in bulk between attributes and nested selectors. Seems to me that this would have the benefit of _not_ using the ampersand character and thus avoiding complications with pre-processors...

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4748 using your GitHub account

Received on Wednesday, 5 February 2020 19:23:42 UTC