Sass variable default scope
问题 I have a problem with using variable defaults in Sass across scopes. My test example is: @mixin foo { $val: 'red' !default; .bar { color: $val; } } @include foo; .class1 { $val: 'green'; @include foo; .class11 { @include foo; } } $val: 'black'; .class2 { @include foo; } .class3 { $val: 'blue'; @include foo; } .class4 { @include foo; } It is compiles to: .bar { color: "red"; } .class1 .bar { color: "red"; } .class1 .class11 .bar { color: "red"; } .class2 .bar { color: "black"; } .class3 .bar {