Sass"@“从根本上”;不起作用
目前我已经安装了sass 3.3,但我正在使用compass进行编译。现在的问题是,我有以下两种混合方法来执行bem语法:Sass"@“从根本上”;不起作用,sass,Sass,目前我已经安装了sass 3.3,但我正在使用compass进行编译。现在的问题是,我有以下两种混合方法来执行bem语法: //elements get appended with "__" and the $name =e($name) @at-root &__#{$name} @content //modifiers get appended with "--" and the $name =m($name) @at-root &--#{$n
//elements get appended with "__" and the $name
=e($name)
@at-root &__#{$name}
@content
//modifiers get appended with "--" and the $name
=m($name)
@at-root &--#{$name}
@content
使用中:
.blocker
+e(item)
color: red
输出:
.blocker {
@at-root &__item {
color: blue;
}
}
为什么它不工作?我尝试了你的mixin,它似乎工作得很好,但是,使用更新的sass语法,你不需要mixin或@at root来实现这一点
.blocker
&__item
color: red
&--mod
color: blue
将编译为
.blocker__item {
color: blue;
}
.blocker--mod {
color: red;
}
如果您想独立于您的环境尝试sass代码本身,请查看。您使用的Compass版本是什么?我尝试了您的建议,不知道它为什么不起作用。这是gist-@SatheeshKumar on sassmeister您需要将gist的设置从SCS更改为Sass。然后间距需要一致,可以缩进2个空格,也可以缩进4个空格。在这之后,它为我编译