csscomb / csscomb.js

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

Allow sorting of custom property (css vars) #636

Open xposedbones opened 4 years ago

xposedbones commented 4 years ago

As of now, if I use this code

.wrapper {
  --gutter: 62px;
  --width: 1314px;
  max-width: calc(var(--width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

it gets sorted like so

.wrapper {
  --width: 1314px;
  max-width: calc(var(--width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);

  --gutter: 62px;
}

is it possible to use the same functionality in the sort-order parameter as $variable but with custom property? It'd be nice we could sort every css vars to be at the top of the block

romazherdev commented 3 years ago

I am also looking forward to be able to sort custom properties.

xposedbones commented 3 years ago

I am also looking forward to be able to sort custom properties.

@Romalei At my company we completely removed the sorting function of csscomb since it was making mess every time we used a css variable, sad but they don't seem to care about that issue

romazherdev commented 3 years ago

That's sad. I wish to find time to create a PR on my own, but not promising anything 😅

S-n-d commented 2 years ago

This would be super useful.