1<===> input.scss
2@mixin foo($out: false) {
3  @if $out {
4    @at-root { @content; }
5  }
6}
7
8@mixin bar() {
9  @at-root { @content; }
10}
11
12@mixin baz($string) {
13  @at-root .#{$string} { @content; }
14}
15
16.test {
17  @include foo(true) {
18    .nest1 {
19      color: red;
20    }
21  }
22  @include bar() {
23    .nest2 {
24      color: green;
25    }
26  }
27  @include baz('nest3') {
28    color: blue;
29  }
30  @at-root {
31    .nest4 {
32      color: yellow;
33    }
34  }
35}
36
37<===> output.css
38.nest1 {
39  color: red;
40}
41.nest2 {
42  color: green;
43}
44.nest3 {
45  color: blue;
46}
47.nest4 {
48  color: yellow;
49}
50