[csswg-drafts] [css-mixins-1] When does (custom) `env()` resolve? (#12676)

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

== [css-mixins-1] When does (custom) `env()` resolve? ==
When a (custom) `env()` is used in a _declaration_ inside a mixin, when do we expect that to resolve? Example:

```
@mixin --m(--color) {
  & {
    color: env(--color);
  }
}
```

Currently, `env()` resolves computed-value-time, together with `var()` and other arbitrary substitution functions. To maintain that, we'd need to "remember" which mixin rule encloses us until computed-value-time. (Which may become even harder depending on what we decide for https://github.com/w3c/csswg-drafts/issues/12675.)

Or, we could specify that these `env()` functions resolve at `@apply`-time, but that would mean that the later stages of the pipeline is unaware that an `env()` ever existed there---I'm not sure if this has any unintended consequences or not. At minimum, we need to define what happens when an `@apply`-time `env()` becomes IACVT (IAAT = invalid at apply time?), because we cannot treat a declaration as `unset` at that point:

```
@mixin --m() {
  & {
    color: env(--invalid); /* What now? */
  }
}
```

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12676 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:06:24 UTC