[csswg-drafts] [css-mixins-1] Lexical vs. dynamic env() scoping (#12677)

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

== [css-mixins-1] Lexical vs. dynamic env() scoping ==
If I understand the current spec correctly, you can not access outer mixin parameters from an inner `@apply` "call", since the target of that `@apply` call won't have the necessary _lexical_ scope in its parent rule chain:

```
@mixin --one() {
  & { color: env(--color); } /* --color not defined here */
}

@mixin --two() {
  @env --color: green;
  @apply --one();
}

div { @apply --two(); }
```
I'm not a huge fan of dynamic scoping personally, and I do get that that authors can just define their envs at the stylesheet-level if they want "globals", but this _feels_ inconsistent with what we decided in https://github.com/w3c/csswg-drafts/issues/10954, so I'd like an explicit decision on this.

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


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

Received on Thursday, 28 August 2025 14:19:15 UTC