Re: [csswg-drafts] [css-nesting-1] Declaration occuring after an invalid nested rule (#7501)

> But in a very cursory glance at a couple of codebases using PostCSS nesting, I found several instances of declarations coming after rules - sometimes in ways that made perfect sense to me in how one might want to group styling decisions. So I wonder if the restriction is worth having.

We tried to follow the specification but this conflicted with mixins and other syntactic sugar build around at rules in the PostCSS ecosystem.

```pcss
.foo {
  @mixin foo;

  color: red;

  .bar {
    color: green;
  }
}
```

When we added a warning that all declarations must precede at rules we immediately got feedback that we broke all the things.

Unhappy side-effect of this is that people can mix and match nesting and declarations.

```pcss
.foo {
  color: red;

  .bar {
    color: green;
  }

  padding: 20px;
}
```

Long story short, the PostCSS plugins for nesting are not a good reference point for this question.

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7501#issuecomment-1275288628 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 11 October 2022 21:21:39 UTC