Skip to content

Instantly share code, notes, and snippets.

@samthurman
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samthurman/7980502c94d37e2c3280 to your computer and use it in GitHub Desktop.
Save samthurman/7980502c94d37e2c3280 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
//breakpoint function, seems solid
@mixin media($breakpoint) {
$queries: (
xs: 24rem,
sm: 40rem,
md: 52rem,
lg: 64rem,
);
@if $breakpoint == 'all' {
@content;
} @else {
@media (min-width: #{map-get($queries, $breakpoint)}) {
@content;
}
}
}
// putting groups of content into this mixin generates loads of unwanted code
@each $breakpoint in (all, xs, sm, md, lg) {
$breakpoint-prefix: if($breakpoint != all, "#{$breakpoint}-", null);
@include media($breakpoint) {
.#{$breakpoint-prefix}uses-breakpoints {
width: percentage(1/12);
}
.does-not-use-breakpoints {
display: block;
}
}
}
.uses-breakpoints {
width: 8.33333%;
}
.does-not-use-breakpoints {
display: block;
}
@media (min-width: 24rem) {
.xs-uses-breakpoints {
width: 8.33333%;
}
.does-not-use-breakpoints {
display: block;
}
}
@media (min-width: 40rem) {
.sm-uses-breakpoints {
width: 8.33333%;
}
.does-not-use-breakpoints {
display: block;
}
}
@media (min-width: 52rem) {
.md-uses-breakpoints {
width: 8.33333%;
}
.does-not-use-breakpoints {
display: block;
}
}
@media (min-width: 64rem) {
.lg-uses-breakpoints {
width: 8.33333%;
}
.does-not-use-breakpoints {
display: block;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment