【发布时间】:2016-01-11 20:34:32
【问题描述】:
我正在与 Bourbon Neat 合作构建我的 css 文件,但我正在查看正在填充的冗余 css。
scss 文件有以下内容:
.col-9 {
@include span-columns(9);
}
.col-3 {
@include span-columns(3);
@include omega();
}
以下内容的 CSS 输出:
.col-9 {
float: left;
display: block;
margin-right: 1.69492%;
width: 74.57627%;
}
.col-9:last-child {
margin-right: 0;
}
.col-3 {
float: left;
display: block;
margin-right: 1.69492%;
width: 23.72881%;
margin-right: 0;
}
.col-3:last-child {
margin-right: 0;
}
以下 css 输出膨胀为以下 css prop
float: left;
display: block;
col-3:last-child 和 col-9:last-child 也可以分组
我做错了吗?如何构建 scss 以获得所需的输出。
.col-9,
.col-3 {
float: left;
display: block;
}
.col-9 {
margin-right: 1.69492%;
width: 74.57627%;
}
.col-3 {
margin-right: 1.69492%;
width: 23.72881%;
margin-right: 0;
}
.col-9:last-child, .col-3:last-child {
margin-right: 0;
}
【问题讨论】:
-
这些自动代码生成器不正常吗?
-
@cimmanon,我不认为这是同一个问题。我的问题与 2 个库(波旁威士忌和整洁)特别相关,如果有人有任何建议以更好的方式编写 scss,从而将具有共同属性的选择器分组。
-
所以看看你正在使用的 mixin 的来源。仅仅因为其他人编写了 mixin 并不意味着他们按照不同的规则进行游戏。
-
@Rob,我了解,但我不确定这是图书馆还是我编写 scss 的方式。我不相信作者在编写程序时会忽略关键细节。在调查源文件时,我希望获得第二意见。