你能拿一个文件并用 sass 稍微更新每个 css 规则吗?例如
样式.scss
.bold {
font-weight: 600
}
.bolder {
font-weight: 800
}
// ...
样式重要.scss
// Here I want to import and produce the following:
.bold-important {
font-weight: 600 !important;
}
.bolder-important {
font-weight: 800 !important;
}
sass可以产生这个吗?另一个 css 预处理器可以完成这个任务吗?
抱歉,Sass 无法做到这一点。您能做的最好的事情就是像这样在数组中循环:
@each $animal in puma, sea-slug, egret, salamander {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
}
}
但这并不能解决你的问题