Skip to content

Instantly share code, notes, and snippets.

@adamtomat
Created September 22, 2014 10:24
Show Gist options
  • Save adamtomat/f5d102534c1163d1854f to your computer and use it in GitHub Desktop.
Save adamtomat/f5d102534c1163d1854f to your computer and use it in GitHub Desktop.
Nesting Sass maps
// Sass 3.3
$example: (
foo: (
x: 100,
y: 200
),
bar: (
x: 150,
y: 250
),
foobar: (
x: 320,
y: 420
)
);
@function map-deep-get($map, $key, $value) {
@return map-get(map-get($map, $key), $value);
}
$bar-x: map-deep-get($example, bar, x);
.foobar {
position: absolute;
top: map-deep-get($example, foobar, y);
left: map-deep-get($example, foobar, x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment