Last active
October 22, 2021 08:57
-
-
Save scheibome/9bb2e4ca750452944401d38f41f351f1 to your computer and use it in GitHub Desktop.
Spacing before and after in scss with scss-maps
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
$spacing-orientation-map: ( | |
'frame-space-before': 'top', | |
'frame-space-after': 'bottom' | |
); | |
$spacing-map: ( | |
'extra-small': '1', | |
'small': '2' | |
); | |
@each $o-key, $o-value in $spacing-orientation-map { | |
.#{$o-key} { | |
@each $key, $value in $spacing-map { | |
&-#{$key} { | |
@if $o-value == top { | |
margin-top: #{$value}rem; | |
} @else if $o-value == bottom { | |
margin-bottom: #{$value}rem; | |
} | |
} | |
} | |
} | |
} | |
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
.frame-space-before-extra-small { | |
margin-top: 1rem; | |
} | |
.frame-space-before-small { | |
margin-top: 2rem; | |
} | |
.frame-space-after-extra-small { | |
margin-bottom: 1rem; | |
} | |
.frame-space-after-small { | |
margin-bottom: 2rem; | |
} |
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
{ | |
"sass": { | |
"compiler": "dart-sass/1.26.11", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment