Skip to content

Instantly share code, notes, and snippets.

@phalkunz
Last active September 3, 2019 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phalkunz/b144b564fdd4328f9c2e506b1dd8a45a to your computer and use it in GitHub Desktop.
Save phalkunz/b144b564fdd4328f9c2e506b1dd8a45a to your computer and use it in GitHub Desktop.
Sass spacing helper
/**
* This is based on https://getbootstrap.com/docs/4.1/utilities/spacing/
*/
$directioMap: (
top: t,
right: r,
left: l,
bottom: b
);
$baseSpace: 5;
@for $n from 0 to 100 {
@each $d in 'top', 'right', 'left', 'bottom' {
$abbr: map-get($directioMap, $d);
.m#{$abbr}-#{$n} {
margin-#{$d}: ($baseSpace * $n) + px;
}
.p#{$abbr}-#{$n} {
padding-#{$d}: ($baseSpace * $n) + px;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment