Kronuz / pyScss

pyScss, a Scss compiler for Python
MIT License
582 stars 140 forks source link

Variable Shadowing #383

Open luc-alquier opened 4 years ago

luc-alquier commented 4 years ago

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 commented 4 years ago

Trivial work around:

$variable: "global value";

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

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