W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2016

[csswg-drafts] [css-apply-rule] Variables in @apply should resolve based on calling context, not defining context

From: Lea Verou via GitHub <sysbot+gh@w3.org>
Date: Mon, 26 Sep 2016 15:24:31 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-179259694-1474903469-sysbot+gh@w3.org>
LeaVerou has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [css-apply-rule] Variables in @apply should resolve based on 
calling context, not defining context ==
For example, in the following code ([live demo - works in Chrome with 
flag](http://dabblet.com/gist/2ad78e799dd967dc75fd8eb8c2130694))

```css
:root {
        --foo: orange;
        --bg: {
                background: var(--foo);
        }
}

body {
        --foo: green;
        @apply --bg;
}
```

`<body>` should be green, not orange. That will allow parameterization
 of `@apply` mixins, which is what authors really want (and already do
 with preprocessors, bloating the CSS size as it spits out different 
code for each call). If it's just about copying a bunch of 
declarations, they can always preprocess that. It's also surprising, 
given that in every other case variables resolve based on current 
element.

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/532 using your GitHub 
account
Received on Monday, 26 September 2016 15:24:39 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:03 UTC