Skip to content

Instantly share code, notes, and snippets.

@toddzebert
Created February 10, 2017 06:02
Show Gist options
  • Save toddzebert/5098c8bb3d401a15a0712b5a3f2fd1c6 to your computer and use it in GitHub Desktop.
Save toddzebert/5098c8bb3d401a15a0712b5a3f2fd1c6 to your computer and use it in GitHub Desktop.
Sharing CSS breakpoints with JavaScript - SCSS
@import "breakpoint";
// loop through the map and add the breakpoints
@mixin add-bp($bps) {
@each $bp-name, $bp in $bps {
@include add-breakpoint($bp-name, $bp);
}
}
// loop through the map and set `content`
@mixin bp-export($bps : $site-breakpoints) {
display: none; // Prevent from displaying, including in chrome inspect!
@each $bp-name, $setting in $bps {
@include respond-to($bp-name) {
content: $bp-name;
}
}
}
// not required, but shows how conversion to ems makes breakpoint sizes "indefinite"
@include breakpoint-set('to ems', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment