Skip to content

Instantly share code, notes, and snippets.

@mattdrose
Created October 15, 2014 21:08
Show Gist options
  • Save mattdrose/ce19003bb85e61f1770c to your computer and use it in GitHub Desktop.
Save mattdrose/ce19003bb85e61f1770c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.5)
// Compass (v1.0.1)
// ----
@function map-deep-merge($map1, $map2) {
$return: $map1;
@each $key, $value in $map2 {
@if map-get($return, $key) != null and type-of($value) == map and type-of(map-get($return, $key)) == map {
$value: map-deep-merge(map-get($return, $key), $value);
}
$return: map-merge($return, ($key: $value));
}
@return $return;
}
@each $yup, $nope in map-get(
map-deep-merge((
foo: (
bar: bar,
bat: bat
)
), (
foo: (
cat: cat,
bar: yup
)
)), foo) {
.#{$yup}-#{$nope} {display:none;}
}
.bar-yup {
display: none;
}
.bat-bat {
display: none;
}
.cat-cat {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment