Skip to content

Instantly share code, notes, and snippets.

@xdesro
Created February 7, 2020 16:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdesro/4bb3b1f2d4d8ccd41b3c55fb5e0f9f35 to your computer and use it in GitHub Desktop.
Save xdesro/4bb3b1f2d4d8ccd41b3c55fb5e0f9f35 to your computer and use it in GitHub Desktop.
A mixin for tokenizing `@media` queries.
$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