Created
June 2, 2016 13:16
-
-
Save davidjpfeiffer/5d4db901cafd032fee08b62af1ab9f6a to your computer and use it in GitHub Desktop.
This solution does not actually work, but is extremely close (one character off) from efficiently generating breakpoints with more control than version 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Breakpoint Variables | |
$xs-break: em(400px); | |
$sm-break: em(600px); | |
$md-break: em(800px); | |
$lg-break: em(1000px); | |
$xl-break: em(1200px); | |
// Size Suffixes | |
$xs-suffix: "-xs"; | |
$sm-suffix: "-sm"; | |
$md-suffix: "-md"; | |
$lg-suffix: "-lg"; | |
$xl-suffix: "-xl"; | |
$breakpoint-map: ( | |
$xs-suffix: $xs-break, | |
$sm-suffix: $sm-break, | |
$md-suffix: $md-break, | |
$lg-suffix: $lg-break, | |
$xl-suffix: $xl-break | |
); | |
@mixin breakpoint($suffix, $break) { | |
@media (min-width: $break) { | |
#{$suffix} { @content; } | |
} | |
} | |
@mixin breakpoints { | |
@each $suffix, $break in $breakpoint-map { | |
@include breakpoint($suffix, $break) { @content; } | |
} | |
} | |
@include breakpoints { | |
.hide & { | |
display: none; | |
} | |
.show & { | |
display: block; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment