Last active
August 29, 2015 14:18
-
-
Save wilkerlucio/84949414132bc663bf76 to your computer and use it in GitHub Desktop.
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 characters
generate-spaces("n" 0, "xs" 20px, "s" 40px, "m" 120px, "l" 100px, "xl" 240px); | |
// examples: | |
// pan = padding all none | |
// mvxs = margin vertical x-small |
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 characters
generate-spaces-prefixed(prefix, sizes...) { | |
types = "margin" "padding"; | |
for ty in types { | |
ti = substr(ty, 0, 1) | |
for st in sizes { | |
key = st[0]; | |
val = st[1] !important; | |
{"." + prefix + ti + "a" + key + ", ." + prefix + ti + "t" + key + ", ." + prefix + ti + "v" + key} { | |
{ty + "-top"}: val; | |
} | |
{"." + prefix + ti + "a" + key + ", ." + prefix + ti + "r" + key + ", ." + prefix + ti + "h" + key} { | |
{ty + "-right"}: val; | |
} | |
{"." + prefix + ti + "a" + key + ", ." + prefix + ti + "b" + key + ", ." + prefix + ti + "v" + key} { | |
{ty + "-bottom"}: val; | |
} | |
{"." + prefix + ti + "a" + key + ", ." + prefix + ti + "l" + key + ", ." + prefix + ti + "h" + key} { | |
{ty + "-left"}: val; | |
} | |
} | |
} | |
} | |
generate-spaces(sizes...) { | |
types = "margin" "padding"; | |
for ty in types { | |
ti = substr(ty, 0, 1) | |
for st in sizes { | |
key = st[0]; | |
val = st[1] !important; | |
{"." + ti + "a" + key + ", ." + ti + "t" + key + ", ." + ti + "v" + key} { | |
{ty + "-top"}: val; | |
} | |
{"." + ti + "a" + key + ", ." + ti + "r" + key + ", ." + ti + "h" + key} { | |
{ty + "-right"}: val; | |
} | |
{"." + ti + "a" + key + ", ." + ti + "b" + key + ", ." + ti + "v" + key} { | |
{ty + "-bottom"}: val; | |
} | |
{"." + ti + "a" + key + ", ." + ti + "l" + key + ", ." + ti + "h" + key} { | |
{ty + "-left"}: val; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment