Sass给我的语法错误:
$colors: (pantone3435c: #2d4838, pantone1788c: #e62c3a, white: #ffffff, pantone3434c: #14482f, pantone468c: #e2cba4, pantone571c: #99d1c7, pantone169c: #f5aea8, pantone1345c: #f5aea8, pantone672c: #e29fc7);
@each $name, $color in $colors {
body.#{$name} {
background: $color;
}
}
它在sassmeister.com上编译得很好,但在主机上没有安装Sass 3.3.3(Maptastic Maple)。
为了让它发挥作用,我不得不将其重写为:
$colors: pantone3435c #2d4838, pantone1788c #e62c3a, white #ffffff, pantone3434c #14482f, pantone468c #e2cba4, pantone571c #99d1c7, pantone169c #f5aea8, pantone1345c #f5aea8, pantone672c #e29fc7;
@each $entry in $colors {
$name: nth($entry, 1);
$color: nth($entry, 2);
body.#{$name} {
background: $color;
}
}
知道第一个例子有什么问题,或者我的Sass版本不支持它?