我在我的Rails应用程序(3.2.17)中运行此SASS代码:
@each $text, $foreground, $background in (submitted, white, grey),
(partially_paid, white, orange),
(paid, white, green),
(accepted, white, blue),
(declined, red, black),
(waitinglist, black, grey),
(lastminute, white, pink),
(out, white, red),
(blacklist, white, black) {
.label-#{$text},
.badge-#{$text} {
background-color: #{$background} !important;
color: #{$foreground};
}
}
我尝试用Sassmeister验证它,它似乎工作 http://sassmeister.com/gist/7144802
但是Rails会抛出这样的错误:
Sass::SyntaxError - Invalid CSS after "@each $text": expected "in", was ", $foreground, ..."
我做错了什么?