csscomb / csscomb.js

CSS coding style formatter
http://csscomb.com/
MIT License
3.29k stars 457 forks source link

CSScomb collect all $variables togather in scss file. #467

Closed zheeeng closed 8 years ago

zheeeng commented 8 years ago

In csscomb/sublime-csscomb#75, I submitted this question. Here I paste it again. I use CSScomb plugin for sublime. Please save my scss file.

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!

Another bug only appears in sublime, 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;
            ^
rickysullivan commented 8 years ago

For starters, you can could just @return $sum * 2;

tonyganch commented 8 years ago

@zheeeng, hey, this is an issue with your current config. Do you still need help with that?