%not { color: red; } .not { @extend %not; } div:has(%not) { color: black; } bar { span:not(%not) { color: black; } span:not(&.foo) { color: black; } span:not(&%not) { color: black; } }