Skip to content

Instantly share code, notes, and snippets.

@ahaywood
Last active March 23, 2017 15:40
Show Gist options
  • Save ahaywood/6694fc6851d9d677050ba8b7601daa17 to your computer and use it in GitHub Desktop.
Save ahaywood/6694fc6851d9d677050ba8b7601daa17 to your computer and use it in GitHub Desktop.
Setting up breakpoints
$breakpoints: (
small: 767px,
medium: 992px,
large: 1200px
);
// _mixins.scss
@mixin breakpoint($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
@media (min-width: #{map-get($breakpoints, $breakpoint)}) {
@content;
}
}
@else {
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. "
+ "Please make sure it is defined in `$breakpoints` map.";
}
}
// Scss
.m-tabs {
background-color: #f2f2f2;
@include breakpoint(medium) {
background-color: #666;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment