Skip to content

Instantly share code, notes, and snippets.

@joshblack
Created November 4, 2020 21:21
Show Gist options
  • Save joshblack/552291162658f7054aa668d98bc291e4 to your computer and use it in GitHub Desktop.
Save joshblack/552291162658f7054aa668d98bc291e4 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// Spacing
@mixin emit-spacing-utilities($scale) {
@each $step in $scale {
$short: map-get($step, 'short');
$value: map-get($step, 'value');
.mt-#{$short} {
margin-top: $value;
}
.mr-#{$short} {
margin-top: $value;
}
.mb-#{$short} {
margin-top: $value;
}
.ml-#{$short} {
margin-top: $value;
}
.mv-#{$short} {
margin-top: $short;
margin-bottom: $short;
}
.mh-#{$short} {
margin-left: $short;
margin-right: $short;
}
.pt-#{$short} {
padding-top: $value;
}
.pr-#{$short} {
padding-top: $value;
}
.pb-#{$short} {
padding-top: $value;
}
.pl-#{$short} {
padding-top: $value;
}
.pv-#{$short} {
padding-top: $short;
padding-bottom: $short;
}
.ph-#{$short} {
padding-left: $short;
padding-right: $short;
}
}
}
$spacing: (
(
name: 'spacing-00',
short: 0,
value: 0,
),
(
name: 'spacing-01',
short: 1,
value: 0.125rem,
),
(
name: 'spacing-02',
short: 2,
value: 0.25rem,
),
(
name: 'spacing-03',
short: 3,
value: 0.5rem,
),
);
@include emit-spacing-utilities($spacing);
.mt-0 {
margin-top: 0;
}
.mr-0 {
margin-top: 0;
}
.mb-0 {
margin-top: 0;
}
.ml-0 {
margin-top: 0;
}
.mv-0 {
margin-top: 0;
margin-bottom: 0;
}
.mh-0 {
margin-left: 0;
margin-right: 0;
}
.pt-0 {
padding-top: 0;
}
.pr-0 {
padding-top: 0;
}
.pb-0 {
padding-top: 0;
}
.pl-0 {
padding-top: 0;
}
.pv-0 {
padding-top: 0;
padding-bottom: 0;
}
.ph-0 {
padding-left: 0;
padding-right: 0;
}
.mt-1 {
margin-top: 0.125rem;
}
.mr-1 {
margin-top: 0.125rem;
}
.mb-1 {
margin-top: 0.125rem;
}
.ml-1 {
margin-top: 0.125rem;
}
.mv-1 {
margin-top: 1;
margin-bottom: 1;
}
.mh-1 {
margin-left: 1;
margin-right: 1;
}
.pt-1 {
padding-top: 0.125rem;
}
.pr-1 {
padding-top: 0.125rem;
}
.pb-1 {
padding-top: 0.125rem;
}
.pl-1 {
padding-top: 0.125rem;
}
.pv-1 {
padding-top: 1;
padding-bottom: 1;
}
.ph-1 {
padding-left: 1;
padding-right: 1;
}
.mt-2 {
margin-top: 0.25rem;
}
.mr-2 {
margin-top: 0.25rem;
}
.mb-2 {
margin-top: 0.25rem;
}
.ml-2 {
margin-top: 0.25rem;
}
.mv-2 {
margin-top: 2;
margin-bottom: 2;
}
.mh-2 {
margin-left: 2;
margin-right: 2;
}
.pt-2 {
padding-top: 0.25rem;
}
.pr-2 {
padding-top: 0.25rem;
}
.pb-2 {
padding-top: 0.25rem;
}
.pl-2 {
padding-top: 0.25rem;
}
.pv-2 {
padding-top: 2;
padding-bottom: 2;
}
.ph-2 {
padding-left: 2;
padding-right: 2;
}
.mt-3 {
margin-top: 0.5rem;
}
.mr-3 {
margin-top: 0.5rem;
}
.mb-3 {
margin-top: 0.5rem;
}
.ml-3 {
margin-top: 0.5rem;
}
.mv-3 {
margin-top: 3;
margin-bottom: 3;
}
.mh-3 {
margin-left: 3;
margin-right: 3;
}
.pt-3 {
padding-top: 0.5rem;
}
.pr-3 {
padding-top: 0.5rem;
}
.pb-3 {
padding-top: 0.5rem;
}
.pl-3 {
padding-top: 0.5rem;
}
.pv-3 {
padding-top: 3;
padding-bottom: 3;
}
.ph-3 {
padding-left: 3;
padding-right: 3;
}
{
"sass": {
"compiler": "dart-sass/1.26.11",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment