Skip to content

Instantly share code, notes, and snippets.

@xzyfer
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save xzyfer/9e8e20ffe4ca184321b7 to your computer and use it in GitHub Desktop.

Select an option

Save xzyfer/9e8e20ffe4ca184321b7 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$breakpoints: (
// This needs to be quoted otherwse only the `(max-width: 900px)`
// is outputted.
"small": "(min-width: 480px) and (max-width: 900px)",
// "small": (min-width: 480px) and (max-width: 900px),
"medium": (min-width: 480px),
);
/// Responsive manager.
/// @access public
/// @param {String} $breakpoint - Breakpoint
/// @requires $breakpoints
/// Taken from http://sass-guidelin.es/#media-queries-usage
@mixin respond-to($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
$query: map-get($breakpoints, $breakpoint);
$query: if(type-of($query) == "string", unquote($query), inspect($query));
@media #{$query} {
@content;
}
}
@else {
@error 'No value found for `#{$breakpoint}`. '
+ 'Please make sure it is defined in `$breakpoints` map.';
}
}
.input {
@include respond-to('small') {
color: red;
}
}
@media (min-width: 480px) and (max-width: 900px) {
.input {
color: red;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment