List Functions
Lists in Sass are immutable; all list functions return a new list rather than updating the existing list in place.
All list functions work for maps as well, treating them as lists of pairs. For example, the map (register: green, sign-out: red) would be treated as ((register, green), (sign-out, red)).
length($list)
Returns the length of a list.
nth($list, $n)
Returns a specific item in a list.
set-nth($list, $n, $value)
Replaces the nth item in a list.
join($list1, $list2, [$separator])
Joins together two lists into one.
append($list1, $val, [$separator])
Appends a single value onto the end of a list.
zip($lists…)
Combines several lists into a single multidimensional list.
index($list, $value)
Returns the position of a value within ...
Get Pragmatic Guide to Sass 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.