-
-
Save hashchange/7cd4163cf82c76503033eac8e5cb23be to your computer and use it in GitHub Desktop.
Sort a SASS map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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