I want to do something like this:
@mixin context($size) { body.#{$size} { @content } } div { span { font-size: 2em; @include context('large') { & { font-size: 5em; } } } } To produce:
div span { font-size: 2em; } body.large div span { font-size: 5em; } What it ACTUALLY (predictably) produces:
div span { font-size: 2em; } div span body.large { font-size: 5em; } I could just replicate the selectors inside different mixins, but given that selectors could be complex that's a lot of extra junk:
@include context('large') { div { span { font-size: 5em; } } } I could make the selectors into mixins so I don't have to repeat them each time, but...
Isn't there a way to use placeholders, maybe in combination with mixins, to get what I want in the first two code blocks above?