【发布时间】:2012-06-25 01:42:22
【问题描述】:
我知道 css 规则相当复杂;但是,优化器不能以多种方式简单地减少以下 css 吗?如果是这样,在 rails-sass gem 中是否有它的选项?
span {
background: red;
color: green;
}
.test2 {
background: red;
color: green;
}
span {
background: green;
color: inherit;
}
.test2 {
background: inherit !important;
color: inherit;
color: inherit;
color: inherit;
}
其他背景:
为了帮助澄清,我也提出以下建议......
来源:
span {
background: red;
}
span {
background: orange;
color: green;
}
span {
background: yellow;
}
span {
background: blue;
color: green;
}
而且,我希望编译器生成以下内容:
span {
background: blue;
color: green;
}
我知道有多余的样式,但是在不断修改样式表时会发生很多次,我想消除死代码。
【问题讨论】:
-
你可以通过CSSTidy或类似的方式运行输出的CSS。
-
你找到方法了吗?截至 2019 年实现这一目标的建议方法是什么?