【发布时间】:2013-12-18 00:59:51
【问题描述】:
我是 SASS 新手,如果这看起来很明显,请耐心等待。
我有一些测试 SASS 代码:
$background : "yellow";
$color : "green";
%my-placeholder {
background: $background;
color: $color;
}
@mixin my-mixin($background,$color) {
%my-placeholder {
background: $background;
color: $color;
}
}
.my-class {
/* Why does this 'my-mixin()' NOT get included to the class? */
@include my-mixin($background,$color);
color: blue;
}
它是变量、占位符和mixin的组合,输出:
.my-class {
/* Why does this 'my-mixin()' NOT get included to the class? */
color: blue;
}
如您所见,mixin 的 @include 调用覆盖占位符,并没有在 .my-class 选择中使用。这是为什么呢?
我有一个 SASS 大师,你可以在其中看到这个直播: http://sassmeister.com/gist/8015459
这是正常行为吗?为了使用此功能,我是否缺少依赖项?
谢谢!
【问题讨论】:
-
兄弟
%也代表什么? -
@VivekVikranth 这是extend only selelector (or placeholder)