Created
October 9, 2019 04:46
-
-
Save cvan/01c9f28ad7b69784472b38a4258e539d to your computer and use it in GitHub Desktop.
tailwindcss-like SASS 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
$spacings: ( | |
xxl: 110, | |
xl: 80, | |
l: 60, | |
m: 40, | |
s: 20, | |
xs: 10, | |
xx: 8, | |
); | |
$sides: (top, right, bottom, left); | |
@each $sizeName, $value in $spacings { | |
@each $side in $sides { | |
.p#{str-slice($side, 0, 1)}-#{$sizeName} { | |
padding-#{$side}: #{$value}; | |
} | |
.-m#{str-slice($side, 0, 1)}-#{$sizeName} { | |
margin-#{$side}: -#{$value}; | |
} | |
.m#{str-slice($side, 0, 1)}-#{$sizeName} { | |
margin-#{$side}: #{$value}; | |
} | |
} | |
.px-#{$sizeName} { | |
padding-left: #{$value}; | |
padding-right: #{$value}; | |
} | |
.py-#{$sizeName} { | |
padding-top: #{$value}; | |
padding-bottom: #{$value}; | |
} | |
.-mx-#{$sizeName} { | |
margin-left: -#{$value}; | |
margin-right: -#{$value}; | |
} | |
.-my-#{$sizeName} { | |
margin-top: -#{$value}; | |
margin-bottom: -#{$value}; | |
} | |
.mx-#{$sizeName} { | |
margin-left: #{$value}; | |
margin-right: #{$value}; | |
} | |
.my-#{$sizeName} { | |
margin-top: #{$value}; | |
margin-bottom: #{$value}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment