Skip to content

Instantly share code, notes, and snippets.

@demoon84
Created March 20, 2017 06:36
Show Gist options
  • Save demoon84/3579c5740188d8d48a78dd70ffed404e to your computer and use it in GitHub Desktop.
Save demoon84/3579c5740188d8d48a78dd70ffed404e to your computer and use it in GitHub Desktop.
breakpoint mixin
// Breakpoint
$mobile: 320px;
$mobileMax: 425px;
$tablet: 640px;
$pc: 960px;
$max: 1260px;
$hidpi: "$hidpi";
@mixin breakpoint($name) {
@if $name == "$hidpi" {
@media (-webkit-min-device-pixel-ratio: 1.5),
(min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
@content;
}
}
@else {
// $value: map-get($breakpoints, $name); // If the key exists in the map
$value : $name;
@if $value != null { // Prints a media query based on the value
@media (min-width: $value) {
@content;
}
}
}
}
@include breakpoint($tablet){}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment