$responsive-design: "mobile" !default; $breakpoint-desktop: 1440px !default; $breakpoint-laptop: 1280px !default; $breakpoint-tablet-landscape: 1024px !default; $breakpoint-tablet-portrait: 768px !default; $breakpoint-mobile-landscape: 480px !default; $breakpoint-mobile-portrait: 320px !default; @mixin if-min($min) { @media only screen and (min-width: $min) { @content; } } @mixin if-max($max) { @media only screen and (max-width: $max) { @content; } } @mixin if-min-max($min, $max) { @media only screen and (min-width: $min) and (max-width: $max) { @content; } } @mixin if-landscape { @media only screen and (orientation: landscape) { @content; } } @mixin if-portrait { @media only screen and (orientation: portrait) { @content; } } // Either support desktop-first or mobile-first responsive pattern @mixin do-responsive($desktop, $mobile) { @if $responsive-design == "desktop" { @if $desktop { @include if-max($desktop) { @content; } } @else { @content; } } @else { @if $mobile { @include if-min($mobile) { @content; } } @else { @content; } } } //-------------------- Breakpoints --------------------// // Uses min or max @mixin if-desktop { @include do-responsive(null, $breakpoint-tablet-landscape) { @content; } } @mixin if-tablet-landscape { @include do-responsive($breakpoint-tablet-landscape, $breakpoint-tablet-portrait) { @content; } } @mixin if-tablet-portrait { @include do-responsive($breakpoint-tablet-portrait, $breakpoint-mobile-landscape) { @content; } } @mixin if-mobile-landscape { @include do-responsive($breakpoint-mobile-landscape, $breakpoint-mobile-portrait) { @content; } } @mixin if-mobile-portrait { @include do-responsive($breakpoint-mobile-portrait, null) { @content; } } // Within 2 ranges @mixin in-desktop { @include if-min($breakpoint-tablet-landscape + 1) { @content; } } @mixin in-tablet { @include if-min-max($breakpoint-mobile-landscape + 1, $breakpoint-tablet-landscape) { @content; } } @mixin in-mobile { @include if-max($breakpoint-mobile-landscape) { @content; } }