Created
April 5, 2021 15:00
-
-
Save disgusting-dev/1ca3b07de6039778ac50dc9b7a9abe2f 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
$basicStep: 4px; | |
$stepsAmount: 12; | |
$gaps: ('m': 'margin', 'p': 'padding'); | |
$directions: ( | |
'l': 'left', | |
'r': 'right', | |
't': 'top', | |
'b': 'bottom', | |
'a': 'all', | |
'y': 'vertical', | |
'x': 'horizontal' | |
); | |
@each $gapKey, $gapValue in $gaps { | |
@each $dirKey, $dirValue in $directions { | |
@for $i from 1 through 12 { | |
@if $dirKey == 'a' { | |
.#{$gapKey}#{$dirKey}-#{$i} { | |
#{$gapValue}: $i * $basicStep; | |
} | |
} | |
@else if $dirKey == 'x' { | |
.#{$gapKey}#{$dirKey}-#{$i} { | |
#{$gapValue}-right: $i * $basicStep; | |
#{$gapValue}-left: $i * $basicStep; | |
} | |
} | |
@else if $dirKey == 'y' { | |
.#{$gapKey}#{$dirKey}-#{$i} { | |
#{$gapValue}-top: $i * $basicStep; | |
#{$gapValue}-bottom: $i * $basicStep; | |
} | |
} | |
@else { | |
.#{$gapKey}#{$dirKey}-#{$i} { | |
#{$gapValue}-#{$dirValue}: $i * $basicStep; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment