Last active
August 29, 2015 14:07
-
-
Save envoytravis/42b07208f499a2b1477c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
// ---- | |
// libsass (v2.0.0) | |
// ---- | |
@import "sass-list-maps"; | |
@mixin respond-to($name) { | |
// If the key exists in the map | |
@if map-has-key($breakpoints, $name) { | |
// Prints a media query based on the value | |
@media screen and #{map-inspect(map-get($breakpoints, $name))} { | |
@content; | |
} | |
} | |
// If the key doesn't exist in the map | |
@else { | |
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. " | |
+ "Please make sure it is defined in `$breakpoints` map."; | |
} | |
} | |
$breakpoints: ( | |
('small', 'max-width: 767px' ), | |
('medium', 'min-width: 992px' ), | |
('large', 'max-width: 1200px' ) | |
); | |
.test { | |
@include respond-to('small') { | |
color: red; | |
} | |
} |
This file contains hidden or 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
@media screen and (max-width: 767px) { | |
.test { | |
color: red; } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment