Sort a SASS map
/// map-sort | |
/// Sort map by keys | |
/// @param $map - A SASS map | |
/// @returns A SASS map sorted by keys | |
/// @requires function list-sort | |
/// @author Jake Wilson <jake.e.wilson@gmail.com> | |
@function map-sort($map) { | |
$keys: list-sort(map-keys($map)); | |
$sortedMap: (); | |
@each $key in $keys { | |
$sortedMap: map-merge($sortedMap, ($key: map-get($map, $key))); | |
} | |
@return $sortedMap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
iamandrewluca commentedJan 21, 2018
•
edited
Here is a variant that will sort by values.