Skip to content

Instantly share code, notes, and snippets.

@reidark
Created May 18, 2018 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reidark/91dae0fba5f12bcb2a4293066a085b31 to your computer and use it in GitHub Desktop.
Save reidark/91dae0fba5f12bcb2a4293066a085b31 to your computer and use it in GitHub Desktop.
Generate margin in scss
$margin-slug: 'margin-top', 'margin-right', 'margin-bottom', 'margin-left';
$margin-total: 10;
$margin-increment: 4;
@for $i from 1 through length($margin-slug) {
@for $x from 0 through $margin-total {
.#{nth($margin-slug, $i)}-#{$x} {
#{nth($margin-slug, $i)}: ($x * $margin-increment) + px !important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment