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

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

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Fri, 21 Oct 2016 21:40:50 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-255472033-1477086049-sysbot+gh@w3.org>
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

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