| 1 |
|
| 2 |
error, other { |
| 3 |
border: 1px #f00; |
| 4 |
background-color: #fdd; |
| 5 |
} |
| 6 |
|
| 7 |
pre, span { |
| 8 |
seriousError { |
| 9 |
@extend error; |
| 10 |
font-size: 20px; |
| 11 |
} |
| 12 |
} |
| 13 |
|
| 14 |
hello { |
| 15 |
@extend other; |
| 16 |
color: green; |
| 17 |
div { |
| 18 |
margin: 10px; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
.cool { |
| 23 |
color: red; |
| 24 |
} |
| 25 |
|
| 26 |
.blue { |
| 27 |
color: purple; |
| 28 |
} |
| 29 |
|
| 30 |
.me { |
| 31 |
@extend .cool, .blue; |
| 32 |
} |
| 33 |
|
| 34 |
.hoverlink { @extend a:hover } |
| 35 |
a:hover { text-decoration: underline } |
| 36 |
|
| 37 |
|
| 38 |
// partial matching and selector merging: |
| 39 |
|
| 40 |
div.hello.world.hmm { |
| 41 |
color: blue; |
| 42 |
} |
| 43 |
|
| 44 |
pre, code { |
| 45 |
.okay.span { |
| 46 |
@extend .hello; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
// multiple matches per selector |
| 51 |
.xxxxx .xxxxx .xxxxx { |
| 52 |
color: green; |
| 53 |
} |
| 54 |
|
| 55 |
code { |
| 56 |
@extend .xxxxx; |
| 57 |
color: red; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
// chained |
| 62 |
|
| 63 |
.alpha { |
| 64 |
color: red; |
| 65 |
} |
| 66 |
|
| 67 |
.beta { |
| 68 |
@extend .alpha; |
| 69 |
color: white; |
| 70 |
} |
| 71 |
|
| 72 |
.gama { |
| 73 |
@extend .beta; |
| 74 |
color: blue; |
| 75 |
} |
| 76 |
|
| 77 |
// merging selector sequences |
| 78 |
|
| 79 |
#admin .tabbar a {font-weight: bold} |
| 80 |
#demo .overview .fakelink {@extend a} |
| 81 |
|
| 82 |
a1 b1 c1 d1 { color: red; } |
| 83 |
x1 y1 z1 w1 { @extend a1; } |
| 84 |
|
| 85 |
a2 b2 c2 d2 { color: red; } |
| 86 |
x2 y2 z2 w2 { @extend b2; } |
| 87 |
|
| 88 |
|
| 89 |
a3 b3 c3 d3 { color: red; } |
| 90 |
x3 y3 z3 w3 { @extend c3; } |
| 91 |
|
| 92 |
|
| 93 |
a4 b4 c4 d4 { color: red; } |
| 94 |
x4 y4 z4 w4 { @extend d4; } |
| 95 |
|
| 96 |
// removing common prefix |
| 97 |
|
| 98 |
#butt .yeah .okay { font-weight: bold } |
| 99 |
#butt .umm .sure { @extend .okay } |
| 100 |
|
| 101 |
a9 b9 s9 t9 v9 { color: red; } |
| 102 |
|
| 103 |
a9 b9 x9 y9 z9 { |
| 104 |
@extend v9; |
| 105 |
} |
| 106 |
|
| 107 |
// extends & media |
| 108 |
|
| 109 |
@media print { |
| 110 |
horse { |
| 111 |
color: blue; |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
man { |
| 116 |
color: red; |
| 117 |
@extend horse; |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
// result == match |
| 122 |
|
| 123 |
wassup { |
| 124 |
color: blue; |
| 125 |
@extend wassup; |
| 126 |
} |
| 127 |
|
| 128 |
.foo { |
| 129 |
.wassup { |
| 130 |
@extend .wassup; |
| 131 |
color: blue; |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
// multi-extend |
| 136 |
|
| 137 |
#something { |
| 138 |
color: red; |
| 139 |
} |
| 140 |
|
| 141 |
.x { |
| 142 |
@extend #something; |
| 143 |
} |
| 144 |
|
| 145 |
.y { |
| 146 |
@extend #something; |
| 147 |
} |
| 148 |
|
| 149 |
// twitter-sass-bootstrap infinite loop |
| 150 |
|
| 151 |
.nav-tabs { |
| 152 |
&.nav-justified { |
| 153 |
@extend .nav-justified; |
| 154 |
} |
| 155 |
} |
| 156 |
.nav-justified { |
| 157 |
text-align: justify; |
| 158 |
} |
| 159 |
|
| 160 |
// multi-extend with nesting |
| 161 |
|
| 162 |
.btn:hover, |
| 163 |
.btn:active, |
| 164 |
.btn.active, |
| 165 |
.btn.disabled, |
| 166 |
.btn[disabled]] { |
| 167 |
color: red; |
| 168 |
} |
| 169 |
.edit .actions { |
| 170 |
button { |
| 171 |
float: right; |
| 172 |
@extend .btn; |
| 173 |
} |
| 174 |
} |
| 175 |
.edit { |
| 176 |
.new { |
| 177 |
.actions { |
| 178 |
padding: 0; |
| 179 |
} |
| 180 |
.actions button { |
| 181 |
@extend .btn; |
| 182 |
} |
| 183 |
} |
| 184 |
} |
| 185 |
|