Skip to content

Instantly share code, notes, and snippets.

@mattpilott
Created December 6, 2015 15:44
Show Gist options
  • Save mattpilott/195c8a99c9e8ff10f0b3 to your computer and use it in GitHub Desktop.
Save mattpilott/195c8a99c9e8ff10f0b3 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$columns: 12;
$breakpoints: (
s: null, //iPhone
m: 641px, //iPad
l: 1025px, //Macbook
xl: 1201px, //Macbook Pro
xxl: 1601px //iMac
);
@mixin breakpoints($capped: false) {
@each $prefix, $breakpoint in $breakpoints {
$i: index(map-keys($breakpoints), $prefix);
@if($capped == false) {
$screen: if(
$i == 1,
'only screen',
'only screen and (min-width: #{rem($breakpoint)})'
);
&--#{$prefix} {
@media #{$screen} {
@content;
}
}
} @else if (length($breakpoints) > $i) {
$next-breakpoint: map-get($breakpoints, nth(map-keys($breakpoints), $i + 1));
$query: if(
$i > 1,
'only screen and (min-width: #{rem($breakpoint)}) and (max-width: #{rem(($next-breakpoint)-1)})',
'only screen and (max-width: #{rem(($next-breakpoint)-1)})'
);
&--#{$prefix} {
@media #{$query} {
@content;
}
}
}
}
}
.button {
@include breakpoints() {
color: red;
}
}
.button1 {
@include breakpoints() {
color: red;
}
}
@media only screen {
.button--s {
color: red;
}
}
@media only screen and (min-width: rem(641px)) {
.button--m {
color: red;
}
}
@media only screen and (min-width: rem(1025px)) {
.button--l {
color: red;
}
}
@media only screen and (min-width: rem(1201px)) {
.button--xl {
color: red;
}
}
@media only screen and (min-width: rem(1601px)) {
.button--xxl {
color: red;
}
}
@media only screen {
.button1--s {
color: red;
}
}
@media only screen and (min-width: rem(641px)) {
.button1--m {
color: red;
}
}
@media only screen and (min-width: rem(1025px)) {
.button1--l {
color: red;
}
}
@media only screen and (min-width: rem(1201px)) {
.button1--xl {
color: red;
}
}
@media only screen and (min-width: rem(1601px)) {
.button1--xxl {
color: red;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment