Created
March 4, 2015 12:47
-
-
Save bookwyrm/b36ea4d22606bea80c07 to your computer and use it in GitHub Desktop.
Better Sass through Susy susy-get Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Susy Get | |
// -------- | |
// Return one setting from a grid | |
// - $key : <keyword> | |
// - $layout : <settings> | |
@function susy-get( | |
$key, | |
$layout: map-merge($susy-defaults, $susy) | |
) { | |
$layout: parse-grid($layout); | |
$_options: $layout $susy $susy-defaults; | |
$_break: false; | |
$_return: null; | |
@each $opt in $_options { | |
@if type-of($opt) == map and not($_break) { | |
$_keyset: _susy-deep-has-key($opt, $key...); | |
@if $_keyset { | |
$_return: _susy-deep-get($opt, $key...); | |
$_break: true; | |
} | |
} | |
} | |
@return $_return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment