Created
June 17, 2019 11:47
-
-
Save dmjcomdem/3aa4c7bcaf405955ddac737be67a741c to your computer and use it in GitHub Desktop.
Generation rules helpers
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
$aroundXYList: top, left, bottom, right; | |
$sizeList: ( | |
0: 0, | |
2: 0.2rem, | |
4: 0.4rem, | |
6: 0.6rem, | |
8: 0.8rem, | |
10: 1rem, | |
12: 1.2rem, | |
14: 1.4rem, | |
16: 1.6rem, | |
18: 1.8rem, | |
20: 2rem | |
); | |
$sizeHelpers: ( | |
'font-size': $sizeList, | |
'margin:xy': $sizeList, | |
'padding:xy': $sizeList, | |
); | |
@each $prop, $map in $sizeHelpers { | |
@each $sizeName, $sizeValue in $map { | |
@if ( str-index($prop, ':xy') ) { | |
$_prop: str-slice($prop, 1, str-length($prop) - 3); | |
@each $around in $aroundXYList { | |
.#{$_prop}-#{$around}-#{$sizeName} { | |
#{$_prop}-#{$around}: $sizeValue; | |
} | |
} | |
.#{$_prop}-#{$sizeName} { | |
#{$_prop}: $sizeValue; | |
} | |
} | |
@else { | |
.#{$prop}-#{$sizeName} { | |
#{$prop}: $sizeValue; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment