-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using mixin grid-media-query for multiple breakpoints #70
Comments
Adding an extra each statement in the grid-media-query mixin will accomplish this. @mixin grid-media-query($media-queries){
$breakpoint-found: false;
@each $media-query in $media-queries {
@each $breakpoint in $breakpoints{
$name: nth($breakpoint, 1);
$declaration: nth($breakpoint, 2);
@if $media-query == $name and $declaration{
$breakpoint-found: true;
@media only screen and #{$declaration}{
@content;
}
}
}
}
@if $breakpoint-found == false{
@warn "Breakpoint '#{$media-query}‚' does not exist"
}
} From there, you can just declare: @include grid-media-query((palm, lap)){
// Your code here...
} |
Actually this won't work because you still have a single argument in the mixin signature, but you pass it 2 arguments when including it. Either you have to turn |
Hugo is right. I've since implemented this into my codebase and you need to wrap them in double braces. Which I personally don't mind since it further distinguishes multiple media-query inclusions from singles. I've updated my code example to reflect this. |
Clever. Thanks, guys! |
I'm guessing I know the answer, but is there a way to use the mixin grid-media-query to render a block of styles for multiple breakpoints. For example, if I want styles for the desk and lap breakpoints.
Thanks!
The text was updated successfully, but these errors were encountered: