Last active
August 29, 2015 14:06
-
-
Save jensjns/1e87ccb7c903fa5b35c8 to your computer and use it in GitHub Desktop.
Generate spacing classes
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
/* | |
Usage: {shorthand for rule}{shorthand for direction}{integer-index} | |
{shorthand for rule} | |
p - padding | |
m - margin | |
{shorthand for direction} | |
t - top | |
r - right | |
b - bottom | |
l - left | |
v - vertical | |
h - horizontal | |
a - all | |
{integer-index} | |
[1-8] | |
*/ | |
t(rule, size, u) | |
{rule}-top (u ? unit(size, u) : size) | |
r(rule, size, u) | |
{rule}-right (u ? unit(size, u) : size) | |
b(rule, size, u) | |
{rule}-bottom (u ? unit(size, u) : size) | |
l(rule, size, u) | |
{rule}-left (u ? unit(size, u) : size) | |
v(rule, size, u) | |
t(rule, size, u) | |
b(rule, size, u) | |
h(rule, size, u) | |
r(rule, size, u) | |
l(rule, size, u) | |
a(rule, size, u) | |
{rule} (u ? unit(size, u) : size) | |
spacing(base, numSizes) | |
for n in a v h t r b l | |
for m in 0..numSizes | |
.p{n}{m} | |
n(padding, (m*base), "px") | |
.m{n}{m} | |
n(margin, (m*base), "px") | |
.m{n}a | |
n(margin, auto, false) | |
spacing(10, 8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment