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

Variable Shadowing #383

Open
luc-alquier opened this issue Nov 17, 2019 · 1 comment
Open

Variable Shadowing #383

luc-alquier opened this issue Nov 17, 2019 · 1 comment

Comments

@luc-alquier
Copy link

Variable Shadowing is not supported.
Variables redefined in scope don't preserve globaly defined value.

exemple :

$variable: "global value";

.content {
  $variable: "local value";
  content: $variable;
}

.sidebar {
  content: $variable;
}

should compile as follow:

.content {
  content: "local value";
}
.sidebar {
  content: "global value";
}

Which is the behavior (an spec by the way) of with node sass, https://www.cssportal.com/scss-to-css/, dart-sass v1.18.0, ...

unfortunatly it "compile" like this:

.content {
  content: "local value";
}
.sidebar {
  content: "local value";
}

@luc-alquier
Copy link
Author

Trivial work around:

$variable: "global value";

$back: $variable;
.content {
  $variable: "local value";
  content: $variable;
}

$variable: $back;
.sidebar {
  content: $variable;
}

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

No branches or pull requests

1 participant