Home

Awesome

SassySort

Here are a couple of ways to sort values (including strings) in Sass (~> 3.3).

Disclaimer! While it can be useful to sort numbers in Sass in case of the making of a modular scale or something, it is rarely the case for strings. The main idea behind this repository is to push Sass' syntax to its limit. Long story short: because we can.

Available algorithms

Benchmark

50 items long list

100 items long list

quicksort is well named since it is by far the fastest algorithm: about 3 times faster than shellsort and insertionsort implementations, 4 times faster than selectionsort and 7 times faster than bubblesort.

Install as a Compass extension

  1. gem install SassySort
  2. Add require 'SassySort' to your config.rb
  3. Import it in your stylesheets with @import 'SassySort'

Credits

Thanks to mgechev for his work on sorting algorithms in JavaScript which has been a great help for implementing sorting algorithms in Sass.

More informations about sorting algorithms at http://www.sorting-algorithms.com/.