Re: [csswg-drafts] [css-mixins-1] Expose environmental variables inside apply's contents block (#12631)

I'm not _necessarily_ objecting to this, but ...

> ```css
> @mixin --foo(@contents) {
>  @env --test: lightgreen;
>  @contents;
> }
> 
> @mixin --bar() {
>  @env --test: pink;
>  @apply --foo {
>    background: env(--test); /* lightgreen */
>  }
> }
> ```

... is that indeed desirable behavior from the perspective of `--bar`? This means that `--bar`'s locals can't be "safely" used within `@apply --foo`'s block, since they can be overwritten by `--foo` internals? (Imagine that `--foo` exists elsewhere, and is updated independently of `--bar`).

> I don't see use cases that would require the opposite.

Having a shared intermediate result between stuff in `@apply`-blocks and elsewhere in the mixin?

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


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

Received on Tuesday, 14 October 2025 11:42:03 UTC