Created
January 17, 2015 04:22
-
-
Save DannyJoris/24cdc483103c952aaeb4 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.9) | |
// Compass (v1.0.1) | |
// ---- | |
// Initialize a global variable at root level. | |
// In this case, the `!global` flag is optional. | |
$variable: 'initial value' !global; | |
// Create a mixin that overrides that global variable. | |
@mixin global-variable-overriding { | |
$variable: 'mixin value' !global; | |
} | |
.local-scope::before { | |
// Create a local variable that shadows the global one. | |
$variable: 'local value'; | |
// Include the mixin: it overrides the global variable. | |
@include global-variable-overriding; | |
// Print the variable's value. | |
// It is the **local** one, since it shadows the global one. | |
content: $variable; | |
} | |
// Print the variable in another selector that does no shadowing. | |
// It is the **global** one, as expected. | |
.other-local-scope::before { | |
content: $variable; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.local-scope::before { | |
content: "local value"; | |
} | |
.other-local-scope::before { | |
content: "mixin value"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment