Skip to content

Instantly share code, notes, and snippets.

@shaunbent
Last active August 29, 2015 14:26
Show Gist options
  • Save shaunbent/38f0964fcb832c8df85a to your computer and use it in GitHub Desktop.
Save shaunbent/38f0964fcb832c8df85a to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@function map-combine($source, $map) {
@each $key, $value in $map {
$new: ($key: $value);
@if map-has-key($source, $key) {
$current: map-get($source, $key);
$new: ($key: map-merge($current, $value));
}
$source: map-merge($source, $new);
}
@return $source;
}
$map: (
'pica' : (
'group-a': (
'font-size': 16px,
'line-height': 18px
),
'group-b': (
'font-size': 18px,
'line-height': 20px
)
),
'pica-bold': (
'group-a': (
'font-weight': bold,
'letter-spacing': -1px
),
'group-c': (
'letter-spacing': 0
)
)
);
.pica {
content: inspect(map-get($map, 'pica'));
}
.pica-bold {
content: inspect(map-combine(map-get($map, 'pica'), map-get($map, 'pica-bold')));
}
.pica {
content: ("group-a": ("font-size": 16px, "line-height": 18px), "group-b": ("font-size": 18px, "line-height": 20px));
}
.pica-bold {
content: ("group-a": ("font-size": 16px, "line-height": 18px, "font-weight": bold, "letter-spacing": -1px), "group-b": ("font-size": 18px, "line-height": 20px), "group-c": ("letter-spacing": 0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment