在 中多次定义 mixin 时LESS
,然后按如下方式调用该 mixin
.background-color() {
background: red;
}
.background-color() {
background: yellow;
}
body {
.background-color;
}
结果将是所有定义的 mixin 的组合输出
body {
background: red; // << output from mixin #1
background: yellow; // << output from mixin #2
}
而当您在 Sass 和 Stylus 中应用相同的场景时(当然使用它们自己的语法),当您调用在样式表中多次定义的 mixin 时,只会执行最后定义的一个(它将覆盖所有之前定义的mixins ) 如下。
结果Sass
和Stylus
body {
background: yellow; // << output from mixin #2
}
如何覆盖 mixinLESS
以便输出来自最后定义的 mixin?