- From: EricSL via GitHub <noreply@w3.org>
- Date: Wed, 22 Oct 2025 09:11:31 +0000
- To: public-css-archive@w3.org
I was originally going to propose `var(--x from container my-container)` but then I saw it was common to use dashed idents and thought it unnecessarily verbose. No strong opinions on the particulars of the syntax here.
> > `var(--x from definition)`
>
> This doesn't look doable. (Or I don't understand what it's supposed to do.)
Ideally it would desugar into the function calls you propose in #12927? I thought a little about how this might work with general vars, but I don't think it would be a good idea to have it work with anything other than mixin parameters (and perhaps some new `@local` var type).
I didn't elaborate much on how I imagine this proposal interacting with mixins, but my thoughts in that regard are that, since the proposed var lookup for mixins doesn't behave much like ordinary var lookup, it would be best to specify that mixin parameters don't inherit at all and you should specify how you want to look them up wherever you use them, or at least wherever you use them that isn't the `@apply`ed element. So instead of looking up mixin parameters with `env(--x)` as under the current proposal or `var(--x)` as you propose, you would look them up with `var(--x from definition)`. But you would have at least one more option for how to use them, which is to write a scoped mixin, like this:
```css
@mixin --my-mixin(--color) {
@scope (&) {
.nested .nested {
color: var(--color from scope);
}
}
}
```
So the downside of this variation on var based mixins is that it may be a pain to implement so that you can lookup mixin parameters in multiple ways, and there is usually going to be one right way to look up the parameters of any particular mixin, so it is unnecessarily verbose. The upside of this variation is that you can support both scoped and unscoped mixins without creating two types of mixin, and it's clear at use site that these are not ordinary var lookups and it's explicit what sort of lookup is being done.
--
GitHub Notification of comment by EricSL
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12990#issuecomment-3431264685 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 22 October 2025 09:11:33 UTC