csscomb / csscomb.js

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

Sort order for @each, @if and similars doesn't work #534

Closed celsomtrindade closed 5 years ago

celsomtrindade commented 7 years ago

I'm not able to include the sass code of type @each, @if (and similars) to the sort option.

They get ignored and move the code, messing up with the functions and mixins. This is my sort configuration:

"sort-order": [
    "$variable",
    "$extend",
    "$include",
    "@each",
    "align-items",
    "align-self",
    // more options...
]

This is an example of the code I'm having problems with:

@mixin transition($collection) {
    $string: null;

    @if ($collection == null) {
        $string: $_option-collection;
    } @else {
        $string: $collection;
    }

    transition: $string $time ease-in-out;
}

After compiling, the code changes to this:

@mixin transition($collection) {
    $string: null;
    transition: $string $time ease-in-out;

    @if ($collection == null) {
        $string: $_option-collection;
    } @else {
        $string: $collection;
    }
}

It doesn't work only for the code starting with @, the others work just fine.

jdalton commented 5 years ago

Hi @celsomtrindade!

I'm closing this because unless a PR is created it won't likely be addressed. If you feel strongly about this request I encourage you to dig in and submit a PR 😸