Skip to content

Instantly share code, notes, and snippets.

@mogelbrod
Created May 24, 2021 16:05
Show Gist options
  • Save mogelbrod/42e1de7c73e3d2accc1f07ad6588f368 to your computer and use it in GitHub Desktop.
Save mogelbrod/42e1de7c73e3d2accc1f07ad6588f368 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
$breakpoints: 0 400px 600px 720px 1000px 1280px 1600px !default;
$scale-names: c xs s m l xl hd !default;
$predefined-spacing: 2px 4px 8px 12px 16px 32px 48px;
@function breakpoint($input, $subtract: false) {
$value: $input;
@if type-of($value) == string {
$value: index($scale-names, $input);
@if $value {
$value: $value - 1;
}
}
@if type-of($value) != number {
@error "breakpoint(#{$input}) unknown breakpoint (#{$value})";
}
@if not unitless($value) {
@return $value;
}
@if $value < 1 {
@return 0;
} @else if $value > length($breakpoints) {
@error "breakpoint(#{$input}) outside defined $breakpoints";
}
$pixels: nth($breakpoints, $value + 1);
@if $subtract {
@return $pixels - 1;
}
@return $pixels;
}
// from(X) - from breakpoint X and up
@mixin from($min) {
$min: breakpoint($min);
@if $min == 0 {
@content;
} @else {
@media only screen and (min-width: #{$min}) {
@content;
}
}
}
$predefined-spacing: 0 4px 8px 12px 16px 24px 32px 48px;
@for $i from 1 to index($scale-names, xl) {
$bp: nth($scale-names, $i);
@include from($i - 1) {
@for $j from 1 to length($predefined-spacing) {
.#{$bp}-mb-#{$j - 1} {
margin-bottom: nth($predefined-spacing, $j) !important;
}
.#{$bp}-mt-#{$j - 1} {
margin-top: nth($predefined-spacing, $j) !important;
}
.#{$bp}-pt-#{$j - 1} {
padding-top: nth($predefined-spacing, $j) !important;
}
.#{$bp}-pb-#{$j - 1} {
padding-bottom: nth($predefined-spacing, $j) !important;
}
}
}
}
.c-mb-0 {
margin-bottom: 0 !important;
}
.c-mt-0 {
margin-top: 0 !important;
}
.c-pt-0 {
padding-top: 0 !important;
}
.c-pb-0 {
padding-bottom: 0 !important;
}
.c-mb-1 {
margin-bottom: 4px !important;
}
.c-mt-1 {
margin-top: 4px !important;
}
.c-pt-1 {
padding-top: 4px !important;
}
.c-pb-1 {
padding-bottom: 4px !important;
}
.c-mb-2 {
margin-bottom: 8px !important;
}
.c-mt-2 {
margin-top: 8px !important;
}
.c-pt-2 {
padding-top: 8px !important;
}
.c-pb-2 {
padding-bottom: 8px !important;
}
.c-mb-3 {
margin-bottom: 12px !important;
}
.c-mt-3 {
margin-top: 12px !important;
}
.c-pt-3 {
padding-top: 12px !important;
}
.c-pb-3 {
padding-bottom: 12px !important;
}
.c-mb-4 {
margin-bottom: 16px !important;
}
.c-mt-4 {
margin-top: 16px !important;
}
.c-pt-4 {
padding-top: 16px !important;
}
.c-pb-4 {
padding-bottom: 16px !important;
}
.c-mb-5 {
margin-bottom: 24px !important;
}
.c-mt-5 {
margin-top: 24px !important;
}
.c-pt-5 {
padding-top: 24px !important;
}
.c-pb-5 {
padding-bottom: 24px !important;
}
.c-mb-6 {
margin-bottom: 32px !important;
}
.c-mt-6 {
margin-top: 32px !important;
}
.c-pt-6 {
padding-top: 32px !important;
}
.c-pb-6 {
padding-bottom: 32px !important;
}
@media only screen and (min-width: 400px) {
.xs-mb-0 {
margin-bottom: 0 !important;
}
.xs-mt-0 {
margin-top: 0 !important;
}
.xs-pt-0 {
padding-top: 0 !important;
}
.xs-pb-0 {
padding-bottom: 0 !important;
}
.xs-mb-1 {
margin-bottom: 4px !important;
}
.xs-mt-1 {
margin-top: 4px !important;
}
.xs-pt-1 {
padding-top: 4px !important;
}
.xs-pb-1 {
padding-bottom: 4px !important;
}
.xs-mb-2 {
margin-bottom: 8px !important;
}
.xs-mt-2 {
margin-top: 8px !important;
}
.xs-pt-2 {
padding-top: 8px !important;
}
.xs-pb-2 {
padding-bottom: 8px !important;
}
.xs-mb-3 {
margin-bottom: 12px !important;
}
.xs-mt-3 {
margin-top: 12px !important;
}
.xs-pt-3 {
padding-top: 12px !important;
}
.xs-pb-3 {
padding-bottom: 12px !important;
}
.xs-mb-4 {
margin-bottom: 16px !important;
}
.xs-mt-4 {
margin-top: 16px !important;
}
.xs-pt-4 {
padding-top: 16px !important;
}
.xs-pb-4 {
padding-bottom: 16px !important;
}
.xs-mb-5 {
margin-bottom: 24px !important;
}
.xs-mt-5 {
margin-top: 24px !important;
}
.xs-pt-5 {
padding-top: 24px !important;
}
.xs-pb-5 {
padding-bottom: 24px !important;
}
.xs-mb-6 {
margin-bottom: 32px !important;
}
.xs-mt-6 {
margin-top: 32px !important;
}
.xs-pt-6 {
padding-top: 32px !important;
}
.xs-pb-6 {
padding-bottom: 32px !important;
}
}
@media only screen and (min-width: 600px) {
.s-mb-0 {
margin-bottom: 0 !important;
}
.s-mt-0 {
margin-top: 0 !important;
}
.s-pt-0 {
padding-top: 0 !important;
}
.s-pb-0 {
padding-bottom: 0 !important;
}
.s-mb-1 {
margin-bottom: 4px !important;
}
.s-mt-1 {
margin-top: 4px !important;
}
.s-pt-1 {
padding-top: 4px !important;
}
.s-pb-1 {
padding-bottom: 4px !important;
}
.s-mb-2 {
margin-bottom: 8px !important;
}
.s-mt-2 {
margin-top: 8px !important;
}
.s-pt-2 {
padding-top: 8px !important;
}
.s-pb-2 {
padding-bottom: 8px !important;
}
.s-mb-3 {
margin-bottom: 12px !important;
}
.s-mt-3 {
margin-top: 12px !important;
}
.s-pt-3 {
padding-top: 12px !important;
}
.s-pb-3 {
padding-bottom: 12px !important;
}
.s-mb-4 {
margin-bottom: 16px !important;
}
.s-mt-4 {
margin-top: 16px !important;
}
.s-pt-4 {
padding-top: 16px !important;
}
.s-pb-4 {
padding-bottom: 16px !important;
}
.s-mb-5 {
margin-bottom: 24px !important;
}
.s-mt-5 {
margin-top: 24px !important;
}
.s-pt-5 {
padding-top: 24px !important;
}
.s-pb-5 {
padding-bottom: 24px !important;
}
.s-mb-6 {
margin-bottom: 32px !important;
}
.s-mt-6 {
margin-top: 32px !important;
}
.s-pt-6 {
padding-top: 32px !important;
}
.s-pb-6 {
padding-bottom: 32px !important;
}
}
@media only screen and (min-width: 720px) {
.m-mb-0 {
margin-bottom: 0 !important;
}
.m-mt-0 {
margin-top: 0 !important;
}
.m-pt-0 {
padding-top: 0 !important;
}
.m-pb-0 {
padding-bottom: 0 !important;
}
.m-mb-1 {
margin-bottom: 4px !important;
}
.m-mt-1 {
margin-top: 4px !important;
}
.m-pt-1 {
padding-top: 4px !important;
}
.m-pb-1 {
padding-bottom: 4px !important;
}
.m-mb-2 {
margin-bottom: 8px !important;
}
.m-mt-2 {
margin-top: 8px !important;
}
.m-pt-2 {
padding-top: 8px !important;
}
.m-pb-2 {
padding-bottom: 8px !important;
}
.m-mb-3 {
margin-bottom: 12px !important;
}
.m-mt-3 {
margin-top: 12px !important;
}
.m-pt-3 {
padding-top: 12px !important;
}
.m-pb-3 {
padding-bottom: 12px !important;
}
.m-mb-4 {
margin-bottom: 16px !important;
}
.m-mt-4 {
margin-top: 16px !important;
}
.m-pt-4 {
padding-top: 16px !important;
}
.m-pb-4 {
padding-bottom: 16px !important;
}
.m-mb-5 {
margin-bottom: 24px !important;
}
.m-mt-5 {
margin-top: 24px !important;
}
.m-pt-5 {
padding-top: 24px !important;
}
.m-pb-5 {
padding-bottom: 24px !important;
}
.m-mb-6 {
margin-bottom: 32px !important;
}
.m-mt-6 {
margin-top: 32px !important;
}
.m-pt-6 {
padding-top: 32px !important;
}
.m-pb-6 {
padding-bottom: 32px !important;
}
}
@media only screen and (min-width: 1000px) {
.l-mb-0 {
margin-bottom: 0 !important;
}
.l-mt-0 {
margin-top: 0 !important;
}
.l-pt-0 {
padding-top: 0 !important;
}
.l-pb-0 {
padding-bottom: 0 !important;
}
.l-mb-1 {
margin-bottom: 4px !important;
}
.l-mt-1 {
margin-top: 4px !important;
}
.l-pt-1 {
padding-top: 4px !important;
}
.l-pb-1 {
padding-bottom: 4px !important;
}
.l-mb-2 {
margin-bottom: 8px !important;
}
.l-mt-2 {
margin-top: 8px !important;
}
.l-pt-2 {
padding-top: 8px !important;
}
.l-pb-2 {
padding-bottom: 8px !important;
}
.l-mb-3 {
margin-bottom: 12px !important;
}
.l-mt-3 {
margin-top: 12px !important;
}
.l-pt-3 {
padding-top: 12px !important;
}
.l-pb-3 {
padding-bottom: 12px !important;
}
.l-mb-4 {
margin-bottom: 16px !important;
}
.l-mt-4 {
margin-top: 16px !important;
}
.l-pt-4 {
padding-top: 16px !important;
}
.l-pb-4 {
padding-bottom: 16px !important;
}
.l-mb-5 {
margin-bottom: 24px !important;
}
.l-mt-5 {
margin-top: 24px !important;
}
.l-pt-5 {
padding-top: 24px !important;
}
.l-pb-5 {
padding-bottom: 24px !important;
}
.l-mb-6 {
margin-bottom: 32px !important;
}
.l-mt-6 {
margin-top: 32px !important;
}
.l-pt-6 {
padding-top: 32px !important;
}
.l-pb-6 {
padding-bottom: 32px !important;
}
}
{
"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