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

Allow sorting of custom property (css vars)

Open xposedbones opened this issue 4 years ago • 4 comments

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

xposedbones avatar Jun 25 '20 19:06 xposedbones

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

romazherdev avatar Aug 06 '21 15:08 romazherdev

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

xposedbones avatar Aug 06 '21 15:08 xposedbones

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

romazherdev avatar Aug 09 '21 08:08 romazherdev

This would be super useful.

S-n-d avatar Jan 05 '22 13:01 S-n-d