Last active
November 17, 2017 21:06
-
-
Save enricodeleo/181e96df28588b0f9d5f to your computer and use it in GitHub Desktop.
Loop that generates margin and padding class helpers
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
// loop that generates margin ad padding helper classes | |
// the output is like .margin-5, .margin-top-5, margin-right-5 etc... | |
$properties: (margin, padding); | |
$sides: (top, right, bottom, left); | |
@each $prop in $properties { | |
@for $i from 1 through 14 { | |
.#{$prop}-#{$i*5} { | |
#{$prop}: #{$i*5}px !important; | |
} | |
@each $side in $sides { | |
.#{$prop}-#{$side}-#{$i*5} { | |
#{$prop}-#{$side}: #{$i*5}px !important; | |
} | |
} | |
} | |
} | |
// the output is like .no-margin, .no-padding-top etc... | |
@each $prop in $properties { | |
.no-#{$prop} { | |
#{$prop}: 0 !important; | |
} | |
@each $side in $sides { | |
.no-#{$prop}-#{$side} { | |
#{$prop}-#{$side}: 0 !important; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment