问题复现
@for $n from 1 through 24 {
&.col-#{$n} {
width: ($n / 24) * 100%;
}
}
ps:学到了sass的for循环
要实现一个类选择器 .col-n 指定width的值,这个n的范围是1-24。n是几,width就是n/24
代码写好打包运行时报了一个警告!!!
Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
问题原因
大概是Sass会舍弃 / 做为除法的运算,而我的sass版本为1.5.5 这个版本会报错。
解决问题
重新安装sass指定版本
npm install-D sass@1.32.12