Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do vars only work under :root? #5

Closed
VVey opened this issue Apr 18, 2018 · 1 comment
Closed

Do vars only work under :root? #5

VVey opened this issue Apr 18, 2018 · 1 comment
Labels

Comments

@VVey
Copy link

VVey commented Apr 18, 2018

Is this plugin support to set the vars under the class,
ex.
.test{
--color; red;
}

@jhildenbiddle
Copy link
Owner

jhildenbiddle commented Apr 18, 2018

Vars must be defined as :root-level declarations.

This will work:

:root {
  --a: red;
}

p {
  color: var(--a);
}

This will not work:

p {
  --a: red;
  color: var(--a);
}

Creating a pony/polyfill to handle scoped variables (the second example) simply isn't possible. Many discussions have been had on the topic:

Hence the :root-level limitation. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants