Created
February 7, 2020 16:26
-
-
Save xdesro/4bb3b1f2d4d8ccd41b3c55fb5e0f9f35 to your computer and use it in GitHub Desktop.
A mixin for tokenizing `@media` queries.
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
$bkpoints: ( | |
xs: 27rem, | |
sm: 37.5rem, | |
md: 56.25rem, | |
lg: 62.5rem, | |
xl: 120rem | |
); | |
// ^ This was for a particular client, you can use whichever | |
breakpoints are best for your use case. | |
@mixin screen($screen) { | |
$bk: $screen; | |
// This @if allows you to use values like "md" OR "727px" for | |
custom breakpoints. | |
@if (map-get($bkpoints, $screen)) { | |
$bk: map-get($bkpoints, $screen); | |
} | |
@media screen and (min-width: $bk) { | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment