問題復現
@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