Skip to content

Instantly share code, notes, and snippets.

@ilya-korotya
Created February 17, 2018 13:38
Show Gist options
  • Save ilya-korotya/0f49362b848501f66e20586d5d4ba372 to your computer and use it in GitHub Desktop.
Save ilya-korotya/0f49362b848501f66e20586d5d4ba372 to your computer and use it in GitHub Desktop.
brakepoint sass
$breakpoints: (
'medium': (min-width: 200px),
'large': (min-width: 400px),
'huge': (min-width: 600px),
);
@mixin respond-to($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
@media #{inspect(map-get($breakpoints, $breakpoint))} {
@content;
}
} @else {
@error 'Не указано значение для `#{$breakpoint}`. '
+ 'Пожалуйста, убедитесь, что точка остановки объявлена в карте `$breakpoints`.';
}
}
@include respond-to(medium) {
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment