Created
May 17, 2012 17:41
Revisions
-
pfulton created this gist
May 17, 2012 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ // for the life of me, I can't track down the original place where I found this. // syntax for scale mixin is like this // property, sizes in px, context //@include scale(padding, (16, 14, 12, 9), 20); // 16px is default context size @mixin scale($props, $sizes, $base: 16) { $values: (); $sublists: false; @each $s in $sizes { // unwrap lists for values that have multiple list of values such as text-shadow @if type-of($s) == list { $sublists: true; $vv: (); @each $ss in $s { $vv: append($vv, if(type-of($ss) == number, #{$ss / $base}em, $ss)); } $values: append($values, join((), $vv)); } @else { $values: append($values, if(type-of($s) == number, #{$s / $base}em, $s)); // $values: append($values, #{$s}px); } } $value: join((), $values, if($sublists, comma, space)); @each $prop in $props { #{$prop}: $value } }