Skip to content

Instantly share code, notes, and snippets.

@disgusting-dev
Created April 5, 2021 15:00
Show Gist options
  • Save disgusting-dev/1ca3b07de6039778ac50dc9b7a9abe2f to your computer and use it in GitHub Desktop.
Save disgusting-dev/1ca3b07de6039778ac50dc9b7a9abe2f to your computer and use it in GitHub Desktop.
$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