Skip to content

Instantly share code, notes, and snippets.

@fitzryland
Last active August 29, 2015 13:57
Show Gist options
  • Save fitzryland/9479950 to your computer and use it in GitHub Desktop.
Save fitzryland/9479950 to your computer and use it in GitHub Desktop.
Essential Sass Map Functions
@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