Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very big serious bug! #75

Open
zheeeng opened this issue May 30, 2016 · 1 comment
Open

Very big serious bug! #75

zheeeng opened this issue May 30, 2016 · 1 comment

Comments

@zheeeng
Copy link

zheeeng commented May 30, 2016

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
Copy link
Author

zheeeng commented May 30, 2016

I found a solution: set "$variable" as the first order of "sort-order":

"sort-order": [
            [ "$variable" ],
            [ "$include" ],
           ...
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant