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

This has nothing to do with `@apply`, it's just the normal behavior of
 custom properties.  As far as CSS is concerned, you have:

```css
:root {
  --foo: meaningless-stuff;
  --bg: meaningless-stuff var(--foo) meaningless-stuff;
}
```

It sees the var(), and substitutes it as normal. The fact that you 
later are subbing in --bg via an @apply rule rather than a var() is 
meaningless.

That said, plan for a later version of Custom Properties is to have a 
var() option that causes it to be substituted at time of use (when 
it's used in something other than an untyped custom property), which 
will achieve what you're looking for.

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

Received on Friday, 21 October 2016 21:40:58 UTC