hudochenkov / postcss-sorting

PostCSS plugin to keep rules and at-rules content in order.
MIT License
517 stars 31 forks source link

SASS mixins not getting sorted alphabetically #111

Closed nick-mon1 closed 1 year ago

nick-mon1 commented 1 year ago

Regular css rules are ordered alphabetically sorted but not my sass mixins, which it should do according to these docs here:

These sass mixins are not getting sorted, is that possible?

  @include u-margin-top("05");
  @include u-margin-bottom("05");
  @include u-font("sans", "xs");
  @include u-text("normal", !important);

stylelintrc.json

{
  "extends": ["@18f/identity-stylelint-config"],
  "plugins": ["stylelint-order"],
  "rules": {
    "order/order": ["at-variables","declarations","rules"],
    "order/properties-alphabetical-order": true
  }
}
hudochenkov commented 1 year ago

I'm not sure why there is an impression that at-rules would be sorted alphabetically. There is nothing about it in the docs.

However, it is possible to do, but you'll have to manually specify all mixins in the config:

"order/order": [
    {
        "type": "at-rule",
        "name": "include",
        "parameter": "u-margin-top"
    },
    {
        "type": "at-rule",
        "name": "include",
        "parameter": "u-margin-bottom"
    },
    {
        "type": "at-rule",
        "name": "include",
        "parameter": "u-font"
    },
    "declarations",
    "rules"
]

By the way, at-variables keyword is only for Less syntax. Sass' @include is at-rule.