Last active
August 29, 2015 13:57
-
-
Save fitzryland/9479950 to your computer and use it in GitHub Desktop.
Essential Sass Map Functions
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
@function map($targetMap, $mapList) { | |
$mapItem: $targetMap; | |
@each $mapPart in $mapList { | |
$mapItem: map-get($mapItem, $mapPart); | |
} | |
@return $mapItem; | |
} | |
@function color($colorTree) { | |
@return map($color, $colorTree); | |
} | |
$color: ( | |
purple: ( | |
light: #bca6e3, | |
med: #4700dc, | |
dark: ( | |
primary: #220081 | |
) | |
) | |
); | |
// .element { | |
// color: color(purple dark primary); | |
// } | |
// | |
// COMPILES TO: | |
// | |
//.element { | |
// color: #220081; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment