Created
March 7, 2014 13:21
-
-
Save cahnory/9411373 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.3.0.rc.5) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
// https://docs.google.com/spreadsheet/ccc?key=0AgFzwMiAdIOfdDdkMVhPazVjMnI4eDdtM19VUzhOSVE&usp=sharing | |
@function nth-side($value, $n) { | |
@while length($value) < $n { | |
$value: append($value, nth($value, floor((length($value) + 1)/2))); | |
} | |
@return nth($value, $n); | |
} | |
@function side($value, $side) { | |
$_sides: top right bottom left; | |
$_index: index($_sides, $side); | |
@if $_index { | |
@return nth-side($value, $_index); | |
} | |
@warn "Unknown side `#{$side}` for `side`."; | |
@return null; | |
} | |
$a: 1em; | |
$b: 1em 2em; | |
$c: 1em 2em 3em; | |
$d: 1em 2em 3em 4em; | |
by-index { | |
t: nth-side($a, 1); | |
t: nth-side($a, 2); | |
t: nth-side($a, 3); | |
t: nth-side($a, 4); | |
/**/ | |
t: nth-side($b, 1); | |
t: nth-side($b, 2); | |
t: nth-side($b, 3); | |
t: nth-side($b, 4); | |
/**/ | |
t: nth-side($c, 1); | |
t: nth-side($c, 2); | |
t: nth-side($c, 3); | |
t: nth-side($c, 4); | |
/**/ | |
t: nth-side($d, 1); | |
t: nth-side($d, 2); | |
t: nth-side($d, 3); | |
t: nth-side($d, 4); | |
} | |
by-side { | |
t: side($a, top); | |
t: side($a, right); | |
t: side($a, bottom); | |
t: side($a, left); | |
/**/ | |
t: side($b, top); | |
t: side($b, right); | |
t: side($b, bottom); | |
t: side($b, left); | |
/**/ | |
t: side($c, top); | |
t: side($c, right); | |
t: side($c, bottom); | |
t: side($c, left); | |
/**/ | |
t: side($d, top); | |
t: side($d, right); | |
t: side($d, bottom); | |
t: side($d, left); | |
} |
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
by-index { | |
t: 1em; | |
t: 1em; | |
t: 1em; | |
t: 1em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 1em; | |
t: 2em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 3em; | |
t: 2em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 3em; | |
t: 4em; | |
} | |
by-side { | |
t: 1em; | |
t: 1em; | |
t: 1em; | |
t: 1em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 1em; | |
t: 2em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 3em; | |
t: 2em; | |
/**/ | |
t: 1em; | |
t: 2em; | |
t: 3em; | |
t: 4em; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment