Skip to content

Instantly share code, notes, and snippets.

@craigmdennis
Last active October 30, 2015 17:44
Show Gist options
  • Save craigmdennis/2cf652a90e01129e87ca to your computer and use it in GitHub Desktop.
Save craigmdennis/2cf652a90e01129e87ca to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$tablet: 'min-width: 48em';
$desktop: 'min-width: 62em';
$upto-desktop: 'max-width: 61.9375em';
@mixin media( $breakpoint ) {
@media screen and ( #{$breakpoint} ) {
@content;
}
}
@mixin rwd( $classes: (), $breakpoints: () ) {
@content;
@for $i from 1 through length($classes) {
$breakpoint: nth($breakpoints, $i);
&---#{nth($classes, $i)} {
@include media( $breakpoint ) {
@content;
}
}
}
}
.some-class {
@include rwd( at-tablet at-desktop, $tablet $desktop ) {
background: blue;
}
}
.another-class {
@include rwd( upto-desktop, $upto-desktop ) {
background: red;
}
}
.some-class {
background: blue;
}
@media screen and (min-width: 48em) {
.some-class---at-tablet {
background: blue;
}
}
@media screen and (min-width: 62em) {
.some-class---at-desktop {
background: blue;
}
}
.another-class {
background: red;
}
@media screen and (max-width: 61.9375em) {
.another-class---upto-desktop {
background: red;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment