csscomb / csscomb.js

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

Property "remove-empty-rulesets" don't work into mediaquery #570

Open TokaLazy opened 6 years ago

TokaLazy commented 6 years ago

Issue

I set true for remove-empty-rulesets but when i run my script to format my scss with configuration csscomb i see a mistake.

Configuration csscomb

{
    "always-semicolon": true,
    "color-case": "lower",
    "block-indent": "\t",
    "color-shorthand": true,
    "element-case": "lower",
    "eof-newline": true,
    "leading-zero": false,
    "lines-between-rulesets": false,
    "quotes": "double",
    "remove-empty-rulesets": true,
    "space-before-colon": "",
    "space-after-colon": " ",
    "space-before-combinator": " ",
    "space-after-combinator": " ",
    "space-between-declarations": "\n",
    "space-before-opening-brace": " ",
    "space-after-opening-brace": "\n",
    "space-after-selector-delimiter": "\n",
    "space-before-selector-delimiter": "",
    "space-before-closing-brace": "\n",
    "space-after-sort-group": "",
    "strip-spaces": true,
    "tab-size": true,
    "unitless-zero": true,
    "vendor-prefix-align": false
}

SCSS input


html {}
body { }
main {

}
section {
    // Comment
}

section > article {}

@media screen and (min-width:900px) {
    html {}
    body { }
    main {

    }
    section {
        // Comment
    }

    section > article {}
}

SCSS output

section {
    // Comment
}

@media screen and (min-width:900px) {
    html {}
    body { }
    main {

    }
    section {
        // Comment
    }

    section > article {}
}

As you can see, each selector without property or comment outside of mediaquery are deleted. Instead of media query rules.