Very big serious bug!
zheeeng opened this issue · 1 comments
zheeeng commented
CSScomb messed up my scss file! help!
This issue description is re-edited.
Yesterday, I met up this problem:
Original scss file demo:
@mixin color {
$color: white;
color: $color;
}
After running CSScomb:
@mixin color {
color: $color;
$color: white;
}
I found I cloud set '$variables' as the first order in config file. It solved my problem.
"sort-order": [
[ "$variable" ],
...
]
Very Big, serious, frustrated bugs Today I met.
Bug 1, collect all $variables togather:
Original scss file demo:
@function cal($paras) {
$sum: 0;
@each $para in $paras {
$sum: $sum + $para;
};
$sum: $sum * 2;
@return $sum;
}
After running CSScomb:
@function cal($paras) {
$sum: 0;
$sum: $sum * 2;
@each $para in $paras {
$sum: $sum + $para;
};
@return $sum;
}
This change is unacceptable!
Bug 2, incorrectly process nested list parameters:
Original scss file demo:
@function cal($parasets...) {
$sum: 0;
@each $paraset in $parasets {
@each $para in $paraset {
$sum: $sum + $para;
}
}
@return $sum;
}
.test {
height: cal(20px 20px, 30px 40px 10px);
}
It works fine. But if I call the function by:
.test {
height: cal((20px 20px), (30px 40px 10px));
}
Oops, CSScomb throw a error:
.../Application Support/Sublime Text 3/Packages/CSScomb/node_modules/csscomb/node_modules/csscomb-core/lib/core.js:412
throw e;
^
These bugs frustrated me the whole day. Should I also report these bugs to the repo of CSScomg.js? I haven't test these demos in cli.
zheeeng commented
I found a solution: set "$variable" as the first order of "sort-order":
"sort-order": [
[ "$variable" ],
[ "$include" ],
...
]