Here is a powerful toolbox providing you all the functions you need to manipulate your Sass lists. See complete documentation here.
gem install SassyLists
Install with Bower
bower install SassyLists --save-dev
- Import the partial in your Sass files
sl-chunk()
: returns whether list contains $valuesl-comma-list()
: initializes an empty comma-separated listsl-contain()
: returns whether the list contains the valuesl-count-values()
: counts the number of occurrences of each value of listsl-debug()
: returns list as a stringsl-every()
: returns whether all items from list pass test from given functionsl-explode()
: explodes a string into a list using a string as a delimitersl-first()
: returns first value in listsl-flatten()
: turns multidimensional list into a one-level listsl-has-values()
: checks if list is not emptysl-has-multiple-values()
: checks if list has more than one valuesl-insert-nth()
: inserts value at indexsl-intersection()
: returns a list of shared values across all given listssl-is-empty()
: checks if list is emptysl-is-single()
: checks if list has a single valuesl-is-symmetrical()
: checks if list is symmetricalsl-last()
: returns last value in listsl-last-index()
: returns last index of value in listsl-loop()
: shifts indexes in listsl-prepend()
: prepends value to listsl-purge()
: removes allfalse
andnull
values from listsl-random-value()
: returns random value from listsl-range()
: returns a list of values between 1 and given valuesl-remove()
: removes value in listsl-remove-duplicates()
: removes duplicate values from listsl-remove-nth()
: removes value at indexsl-replace()
: replaces value in listsl-replace-nth()
: replaces value at indexsl-reverse()
: reverses listsl-shuffle()
: shuffles listsl-slice()
: slices listsl-sort()
: sorts listsl-some()
: returns whether some values from list pass test from given functionsl-sum()
: sums all unitless values in listsl-tail()
: returns anything but the first element in listsl-to-list()
: casts value as listsl-to-map()
: casts list as map using indexes as keyssl-to-string()
: casts list as string (JS.join()
)sl-union()
: returns a list of values from given lists minus duplicatessl-walk()
: applies a function to every value of list
If you feel like an explorer, you can have a look at the code here.
- Sass ~> 3.4
If you are looking for the last version of SassyLists running on Sass 3.2, install 0.4.9
.
If you are looking for the last version of SassyLists running on Sass 3.3, install 2.2.5
.
Some functions depend on other functions. If you include functions individually, make sure to check for these dependencies in their respective docs.
- Official site
- Advanced Sass list functions
- Advanced Sass list functions again
- How I made a Sass debug function
A lot of thanks to all contributors and to at-import for their support.