Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sass 101 - A newb's guide: global variables are not scoped

When using global variables, it is important to note that as variables are redefined within the cascade, this will in turn effect the value passed into the preceding variables.

$border-radius: 5px !default;

.block-01 {
  border-radius: $border-radius;
}

.block-02 {
  $border-radius: 10px;
  border-radius: $border-radius;
}

.block-03 {
  border-radius: $border-radius;
}

SassMeister Gist

$border-radius: 5px !default;
.block-01 {
border-radius: $border-radius;
}
.block-02 {
$border-radius: 10px;
border-radius: $border-radius;
}
.block-03 {
border-radius: $border-radius;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment