Skip to content

Instantly share code, notes, and snippets.

@bardouni
Last active July 6, 2017 19:40
Show Gist options
  • Save bardouni/be8588be095e426e7ae99dcae6881f05 to your computer and use it in GitHub Desktop.
Save bardouni/be8588be095e426e7ae99dcae6881f05 to your computer and use it in GitHub Desktop.
Generate margin/padding helper classes
$unit: px
$points: 0,5,10
@each $abbrs, $s in (-i:!important, '':'')
@each $pabbr, $p in (m:margin, p:padding)
@each $size in $points
@each $abbr,$name in (t:-top, b:-bottom, l:-left, r:-right, a:'')
.#{$pabbr}#{$abbr}-#{$size}#{$abbrs}
#{$p}#{$name}: $size#{$unit} #{$s}
@each $abbr, $a1, $a2 in (v,top,bottom),(h,left,right)
.#{$pabbr}#{$abbr}-#{$size}#{$abbrs}
#{$p}-#{$a1}: $size#{$unit} #{$s}
#{$p}-#{$a2}: $size#{$unit} #{$s}
// the Results :
.mt-0 {
margin-top: 0px;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment