Skip to content

Instantly share code, notes, and snippets.

@turusuke
Created May 19, 2021 11:02
Show Gist options
  • Save turusuke/cb3e2495ecb38b5d47b985e76b9634a4 to your computer and use it in GitHub Desktop.
Save turusuke/cb3e2495ecb38b5d47b985e76b9634a4 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
$total-margins: 20 !default;
$margin-unit: 3 !default;
$prefix: 'u-' !default;
@mixin margin() {
@for $index from 1 through $total-margins {
$margin-size: $index * 3;
$base-names: '.p-mt-#{$margin-size}' '.p-ml-#{$margin-size}';
@each $base-name in $base-names {
$indexKey : index($base-names, $base-name) + 1;
* + #{$base-name}:not(:empty) {
@if $indexKey % 2 == 1 {
margin-top: #{$margin-size}px;
} @else {
margin-left: #{$margin-size}px;
}
}
*:empty + #{$base-name} {
@if $indexKey % 2 == 0 {
margin-top: 0;
} @else {
margin-left: 0;
}
}
}
}
}
@include margin()
* + .p-mt-3:not(:empty) {
margin-left: 3px;
}
*:empty + .p-mt-3 {
margin-top: 0;
}
* + .p-ml-3:not(:empty) {
margin-top: 3px;
}
*:empty + .p-ml-3 {
margin-left: 0;
}
* + .p-mt-6:not(:empty) {
margin-left: 6px;
}
*:empty + .p-mt-6 {
margin-top: 0;
}
* + .p-ml-6:not(:empty) {
margin-top: 6px;
}
*:empty + .p-ml-6 {
margin-left: 0;
}
* + .p-mt-9:not(:empty) {
margin-left: 9px;
}
*:empty + .p-mt-9 {
margin-top: 0;
}
* + .p-ml-9:not(:empty) {
margin-top: 9px;
}
*:empty + .p-ml-9 {
margin-left: 0;
}
* + .p-mt-12:not(:empty) {
margin-left: 12px;
}
*:empty + .p-mt-12 {
margin-top: 0;
}
* + .p-ml-12:not(:empty) {
margin-top: 12px;
}
*:empty + .p-ml-12 {
margin-left: 0;
}
* + .p-mt-15:not(:empty) {
margin-left: 15px;
}
*:empty + .p-mt-15 {
margin-top: 0;
}
* + .p-ml-15:not(:empty) {
margin-top: 15px;
}
*:empty + .p-ml-15 {
margin-left: 0;
}
* + .p-mt-18:not(:empty) {
margin-left: 18px;
}
*:empty + .p-mt-18 {
margin-top: 0;
}
* + .p-ml-18:not(:empty) {
margin-top: 18px;
}
*:empty + .p-ml-18 {
margin-left: 0;
}
* + .p-mt-21:not(:empty) {
margin-left: 21px;
}
*:empty + .p-mt-21 {
margin-top: 0;
}
* + .p-ml-21:not(:empty) {
margin-top: 21px;
}
*:empty + .p-ml-21 {
margin-left: 0;
}
* + .p-mt-24:not(:empty) {
margin-left: 24px;
}
*:empty + .p-mt-24 {
margin-top: 0;
}
* + .p-ml-24:not(:empty) {
margin-top: 24px;
}
*:empty + .p-ml-24 {
margin-left: 0;
}
* + .p-mt-27:not(:empty) {
margin-left: 27px;
}
*:empty + .p-mt-27 {
margin-top: 0;
}
* + .p-ml-27:not(:empty) {
margin-top: 27px;
}
*:empty + .p-ml-27 {
margin-left: 0;
}
* + .p-mt-30:not(:empty) {
margin-left: 30px;
}
*:empty + .p-mt-30 {
margin-top: 0;
}
* + .p-ml-30:not(:empty) {
margin-top: 30px;
}
*:empty + .p-ml-30 {
margin-left: 0;
}
* + .p-mt-33:not(:empty) {
margin-left: 33px;
}
*:empty + .p-mt-33 {
margin-top: 0;
}
* + .p-ml-33:not(:empty) {
margin-top: 33px;
}
*:empty + .p-ml-33 {
margin-left: 0;
}
* + .p-mt-36:not(:empty) {
margin-left: 36px;
}
*:empty + .p-mt-36 {
margin-top: 0;
}
* + .p-ml-36:not(:empty) {
margin-top: 36px;
}
*:empty + .p-ml-36 {
margin-left: 0;
}
* + .p-mt-39:not(:empty) {
margin-left: 39px;
}
*:empty + .p-mt-39 {
margin-top: 0;
}
* + .p-ml-39:not(:empty) {
margin-top: 39px;
}
*:empty + .p-ml-39 {
margin-left: 0;
}
* + .p-mt-42:not(:empty) {
margin-left: 42px;
}
*:empty + .p-mt-42 {
margin-top: 0;
}
* + .p-ml-42:not(:empty) {
margin-top: 42px;
}
*:empty + .p-ml-42 {
margin-left: 0;
}
* + .p-mt-45:not(:empty) {
margin-left: 45px;
}
*:empty + .p-mt-45 {
margin-top: 0;
}
* + .p-ml-45:not(:empty) {
margin-top: 45px;
}
*:empty + .p-ml-45 {
margin-left: 0;
}
* + .p-mt-48:not(:empty) {
margin-left: 48px;
}
*:empty + .p-mt-48 {
margin-top: 0;
}
* + .p-ml-48:not(:empty) {
margin-top: 48px;
}
*:empty + .p-ml-48 {
margin-left: 0;
}
* + .p-mt-51:not(:empty) {
margin-left: 51px;
}
*:empty + .p-mt-51 {
margin-top: 0;
}
* + .p-ml-51:not(:empty) {
margin-top: 51px;
}
*:empty + .p-ml-51 {
margin-left: 0;
}
* + .p-mt-54:not(:empty) {
margin-left: 54px;
}
*:empty + .p-mt-54 {
margin-top: 0;
}
* + .p-ml-54:not(:empty) {
margin-top: 54px;
}
*:empty + .p-ml-54 {
margin-left: 0;
}
* + .p-mt-57:not(:empty) {
margin-left: 57px;
}
*:empty + .p-mt-57 {
margin-top: 0;
}
* + .p-ml-57:not(:empty) {
margin-top: 57px;
}
*:empty + .p-ml-57 {
margin-left: 0;
}
* + .p-mt-60:not(:empty) {
margin-left: 60px;
}
*:empty + .p-mt-60 {
margin-top: 0;
}
* + .p-ml-60:not(:empty) {
margin-top: 60px;
}
*:empty + .p-ml-60 {
margin-left: 0;
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"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