1

以下 SCSS 片段在使用compass compile. 但是如果我使用-output_style compressedCSS 则缺少.box-yellow定义。.box-red等生成,但黄色缺失。

$colors: red #f00, yellow #ff0, green #0f0, blue #00f;

@each $entry in $colors {
    $name: nth($entry, 1);
    $color: nth($entry, 2);

    .box-#{$name} > header {
         background: $color;
    }
 }

这可能是一个错误还是我在这里遗漏了什么?

4

1 回答 1

1

不确定这是否是一个错误,但对我来说似乎很奇怪。如果我将样式设置为压缩,我可以在这里使用 v 3.2.3 复制它。奇怪的是,将其缩短到yello可以正常工作。一种解决方法是引用它们:

$colors: "red" #f00, "yellow" #ff0, "green" #0f0, "blue" #00f;

这会产生:

.box-red>header{background:red}.box-yellow>header{background:#ff0}.box-green>header{background:lime}.box-blue>header{background:blue}

现在我再次查看输出,出现了一种模式:其他颜色生成颜色名称而不是十六进制值。

于 2013-02-16T22:52:22.780 回答