csscomb / csscomb.js

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

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

Open tonyganch opened 10 years ago

tonyganch commented 10 years ago

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).
iamstarkov commented 10 years ago

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.

tonyganch commented 10 years ago

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

iamstarkov commented 10 years ago

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

abhishekdev commented 9 years ago

:+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.

iegik commented 8 years ago

preset +1