Re: [csswg-drafts] Proposal: Custom CSS Functions & Mixins (#9350)

I'm not sure if I like the need for explicitly defining the variables that are used from the outer scope. What are the issues does this solve?

And another question: from which scope does it use the variables? From the outermost, closest, or only the immediately above one?

```CSS
@function --foo() using (--var1, --var2) { … }

@function --bar() {
  --var2: 10;
  @return --foo();
}

.foo {
  --var1: 1;
  --var2: 2;
  --test: --bar();
}
```

In this case, will the `--foo` get the `--var1` from the `.foo`? Will it get the `--var2: 10` from the parent function?

Overall, I find the need to explicitly mention all the used variables to be something that could hinder a lot of use cases. Especially those that involve design tokens, as there could be potentially tens and hundreds of these which are involved in a single function. For example, when implementing complex typography rules, where we'd want to use tokens for font-sizes, weights, styles, letter-spacing, text-transform and so on. The requirement to explicitly mention all the tokens will make these functions difficult to write and maintain.


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


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

Received on Friday, 9 February 2024 09:16:08 UTC