Use natural sort for sorting selectors
See original GitHub issueIt appears that clean-css now sorts selectors, whereas it didn’t previously. It seems to be using a simple naive sort, which has somewhat unpleasant results when the selectors have numbers in them. For example:
.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9 {...}
Would it be possible to use natural sorting instead, to obtain more pleasant results? For example:
.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12 {...}
Here are a couple libs I found on npm that might do the job:
Issue Analytics
- State:
- Created 9 years ago
- Comments:9
Top Results From Across the Web
Use natural sort for sorting selectors · Issue #425 · clean-css ...
It seems to be using a simple naive sort, which has somewhat unpleasant results when the selectors have numbers in them.
Read more >Natural Sort Order in C# - Stack Overflow
The easiest thing to do is just P/Invoke the built-in function in Windows, and use it as the comparison function in your IComparer...
Read more >Natural sorting - Rosetta Code
1. Ignore leading, trailing and multiple adjacent spaces · 2. Make all whitespace characters equivalent. · 3. Sorting without regard to case. ·...
Read more >Natural-Order Filename Sort - File Exchange - MATLAB Central
Alphanumeric sort of filenames or filepaths, with customizable number format. ... To sort the elements of a string/cell array use NATSORT:.
Read more >Collection processing in Kotlin: Sorting, shuffling and reversing
sorted can only be used on a list of elements with natural order for elements that implement the Comparable interface. The most important...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ready on master and soon in 4.0. Available via:
Thanks @jessehouchins for your input. I’m still considering it and leaving it open as an enhancement.