How stylus deals with variables scope?
—
1- Are all variables global?
$foo = red // is $foo global?
2- Similarly to the commonJS module, is there any exports/require equivalent?
$foo = @import 'foo'
body { color: $foo }
3- What about variables declared in a CSS block, maybe with mixins:
$foo = green
bar()
$foo = yellow // is it the same $foo ?
$baz = blue. // local or implied global?
ul {
background: $foo // green or yellow? red?
$foo = red
li {
$foo = pink
}
color: $foo // pink?
bar() // what about $foo now?
}
—
Would appreciate any clarification or documentation about this…
Thank you
If you slightly reword part #3 of your question:
Then stylus will answer it: