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

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