Skip to content

Instantly share code, notes, and snippets.

@CodeRecipez
Last active December 15, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeRecipez/5260759 to your computer and use it in GitHub Desktop.
Save CodeRecipez/5260759 to your computer and use it in GitHub Desktop.
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