Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active December 16, 2015 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunelson/5487561 to your computer and use it in GitHub Desktop.
Save lunelson/5487561 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
// hack of map/hash functionality, works best with SCSS syntax
// works with list of tuples; can accept key-value in either order.
@function value($map, $key) {
@each $pair in $map {
$i: index($pair, $key);
@if $i {
@return nth($pair, 3 - $i);
}
}
}
$test-map:
position absolute,
bottom 0px,
5px right;
.test {
position: value($test-map, position);
bottom: value($test-map, bottom);
right: value($test-map, right);
}
.test {
position: absolute;
bottom: 0px;
right: 5px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment