我正在尝试修复我的 gulp-ccs-comb 任务,但出现此错误:
MacBook-Pro:myProject remy$ gulp sass-comb
[11:23:10] Using gulpfile ~/myproject/gulpfile.js
[11:23:10] Starting 'sass-comb'...
[11:23:10] Finished 'sass-comb' after 5.88 ms
events.js:183
throw er; // Unhandled 'error' event
^
Error: /myPath/sass/helpers/_helpers.scss
Parsing error: Please check the validity of the block starting from line #6
4 | @each $className in $list {
5 | @for $i from 0 through 100 {
6*| @if $i % 5 == 0 {
7 | @each $positionName in $listPosition {
8 | .#{$className}#{$positionName}-#{$i} {
Gonzales PE version: 3.0.0-28
SCSS 文件:
$list: margin padding;
$listPosition: top bottom left right;
@each $className in $list {
@for $i from 0 through 100 {
@if $i % 5 == 0 {
@each $positionName in $listPosition {
.#{$className}#{$positionName}-#{$i} {
#{$className}-#{$positionName}: #{$i}px !important;
}
}
.#{$className}-#{$i} {
#{$className}: #{$i}px !important;
}
}
}
}
我的 scss 语法做错了什么?
感谢您的帮助:)
雷米。
最佳答案
尝试将@for
和@if
更改为@while
。
$list: margin padding;
$listPosition: top bottom left right;
@each $className in $list {
$i: 0;
@while $i <= 100 {
@each $positionName in $listPosition {
.#{$className}#{$positionName}-#{$i} {
#{$className}-#{$positionName}: #{$i}px !important;
}
}
.#{$className}-#{$i} {
#{$className}: #{$i}px !important;
}
$i: $i + 5;
}
}
它对我有用(以及你的代码:)
关于sass - gulp-css-comb : "Please check the validity" 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48261125/