| 1 |
$x: global-x; |
| 2 |
$y: global-y; |
| 3 |
$z: global-z; |
| 4 |
|
| 5 |
@mixin foo($x, $y) { |
| 6 |
/* begin foo */ |
| 7 |
margin: $x $y; |
| 8 |
blip { |
| 9 |
hey: now; |
| 10 |
} |
| 11 |
/* end foo */ |
| 12 |
} |
| 13 |
|
| 14 |
@mixin foogoo($x, $y, $z) { |
| 15 |
margin: $x $y $z; |
| 16 |
} |
| 17 |
|
| 18 |
@mixin hux($y) { |
| 19 |
/* begin hux */ |
| 20 |
color: $y; |
| 21 |
@include foo(called-from-hux, $y: $y); |
| 22 |
/* end hux */ |
| 23 |
} |
| 24 |
|
| 25 |
div { |
| 26 |
@include foo(1, 2); |
| 27 |
@include foo(1, 3); |
| 28 |
@include foogoo(1, 2, $z: zee); |
| 29 |
@include foogoo(1, $y /* blah */ : kwd-y, $z: kwd-z); |
| 30 |
} |
| 31 |
|
| 32 |
div { |
| 33 |
@include hux($y: $y); |
| 34 |
} |
| 35 |
|
| 36 |
$y: different-global-y; |
| 37 |
|
| 38 |
div { |
| 39 |
@include hux(calling-hux-again); |
| 40 |
} |
| 41 |
|
| 42 |
@mixin bung() { |
| 43 |
blah: original-bung; |
| 44 |
} |
| 45 |
|
| 46 |
div { |
| 47 |
@include bung(); |
| 48 |
} |
| 49 |
|
| 50 |
@mixin bung() { |
| 51 |
blah: redefined-bung; |
| 52 |
} |
| 53 |
|
| 54 |
div { |
| 55 |
@include bung(); |
| 56 |
} |
| 57 |
|
| 58 |
div { |
| 59 |
/* calls to nullary mixins may omit the empty argument list */ |
| 60 |
@include bung; |
| 61 |
} |
| 62 |
|
| 63 |
div { |
| 64 |
@include foo($x: kwdarg1, $y: kwdarg2); |
| 65 |
} |
| 66 |
|
| 67 |
@mixin ruleset() { |
| 68 |
hoo { |
| 69 |
color: boo; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
@include ruleset(); |
| 74 |
|
| 75 |
$da: default argument; |
| 76 |
|
| 77 |
@mixin default_args($x, $y: $da) { |
| 78 |
blah: $x $y; |
| 79 |
} |
| 80 |
$da: some other default; |
| 81 |
|
| 82 |
div { |
| 83 |
@include default_args(boogoo); |
| 84 |
} |
| 85 |
|
| 86 |
@mixin original() { |
| 87 |
value: original; |
| 88 |
} |
| 89 |
|
| 90 |
div { |
| 91 |
@include original(); |
| 92 |
} |
| 93 |
|
| 94 |
@mixin original() { |
| 95 |
value: no longer original; |
| 96 |
} |
| 97 |
|
| 98 |
div { |
| 99 |
@include original(); |
| 100 |
} |
| 101 |
|
| 102 |
@mixin set-x($x) { |
| 103 |
$x: changed local x; |
| 104 |
arg: $x; |
| 105 |
$y: changed global y !global; |
| 106 |
blarg: $y; |
| 107 |
} |
| 108 |
|
| 109 |
div { |
| 110 |
@include set-x(blah); |
| 111 |
a: $x; |
| 112 |
b: $y; |
| 113 |
} |