csscomb.js icon indicating copy to clipboard operation
csscomb.js copied to clipboard

Sort order fallback: Add `yandex`, `zen` and `csscomb`

Open tonyganch opened this issue 10 years ago • 5 comments

From discussion with @matmuchrapna:

Allow using sort orders from predefined configs as sort-order-fallback option. For example:

{
  "always-semicolon": true,
  "sort-order": ["color", "..."],
  "sort-order-fallback": "yandex"
}
// Before
a {
  left: 0;
  color: 0;
  top: 0;
}

// Before
a {
  color: 0;
  top: 0;
  left: 0;
}

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/3961833-sort-order-fallback-add-yandex-zen-and-csscomb?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github).

tonyganch avatar Aug 21 '14 11:08 tonyganch

From issue's description it's not clear that I want not exact sort-order-fallback, because it will not work without sort-order, but I should not be required to define my own sort-order if I want to use sort-order from predefined presets.

iamstarkov avatar Aug 21 '14 12:08 iamstarkov

@matmuchrapna, you can just define in config: "sort-order": ["..."]

tonyganch avatar Aug 21 '14 12:08 tonyganch

ok, but will look like hack, wouldn't it?

iamstarkov avatar Aug 21 '14 13:08 iamstarkov

:+1:

How about just adding a preset option to get all values from a predefined configuration and then extend it with the user defined values. Very similar to jscs presets

example:

{
    "preset": "zen",
    "always-semicolon": true,
    "color-case": "lower",
    "block-indent": "    ",
    "quotes": "double",
    "sort-order-fallback": "abc",
}

This not only solves sort order fallback but allows end user to leverage all existing configs with just a few tweaks to match their taste.

abhishekdev avatar Sep 03 '15 18:09 abhishekdev

preset +1

iegik avatar Feb 09 '16 09:02 iegik