Last active
December 2, 2015 18:24
-
-
Save robbyking3/86894d1e44732f2a0c76 to your computer and use it in GitHub Desktop.
A messy less port of a sass version
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
| // based on https://github.com/kianoshp/SASS-CSS-Boilerplate/blob/master/sass/padding-margin.scss | |
| .sizeMaker() { | |
| @paddingMargins: p,m; | |
| @positions: t,r,b,l; | |
| @padding-increment: 5px; | |
| @sizes: s,m,l,n; | |
| @pm: padding; | |
| @pos: top; | |
| @sz: 0; | |
| @hvpos: v; | |
| .for(@paddingMargins); .-each(@paddingMargin) { | |
| @tempVar: ~"@{paddingMargin}"; | |
| .setPM(@paddingMargin) when (@paddingMargin = p) { | |
| @pm: padding; | |
| } | |
| .setPM(@paddingMargin) when (@paddingMargin = m) { | |
| @pm: margin; | |
| } | |
| .setPM(@paddingMargin); | |
| .for(@positions); .-each(@position) { | |
| @tempVar2: ~"@{tempVar}@{position}"; | |
| .setPosition(@position) when (@position = t) { | |
| @pos: top; | |
| @hvpos: v; | |
| } | |
| .setPosition(@position) when (@position = r) { | |
| @pos: right; | |
| @hvpos: h; | |
| } | |
| .setPosition(@position) when (@position = b) { | |
| @pos: bottom; | |
| @hvpos: v; | |
| } | |
| .setPosition(@position) when (@position = l) { | |
| @pos: left; | |
| @hvpos: h; | |
| } | |
| .setPosition(@position); | |
| .for(@sizes); .-each(@size) { | |
| @tempVar3: ~"@{tempVar2}@{size}"; | |
| .setSize(@size) when (@size = s) { | |
| @sz: @padding-increment; | |
| } | |
| .setSize(@size) when (@size = m) { | |
| @sz: @padding-increment * 2; | |
| } | |
| .setSize(@size) when (@size = l) { | |
| @sz: @padding-increment * 4; | |
| } | |
| .setSize(@size) when (@size = n) { | |
| @sz: @padding-increment * 0; | |
| } | |
| .setSize(@size); | |
| .@{tempVar3}, .@{tempVar}a@{size}, .@{paddingMargin}@{hvpos}@{size} { | |
| @{pm}-@{pos}: @sz !important; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| .sizeMaker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment