-
Notifications
You must be signed in to change notification settings - Fork 193
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
Allow OR operator for media queries #143
Conversation
Merge original
* master:
Input is @include media('>phone', 'OR', '<tablet') {
.red {
color: red;
}
}
@include media('>phone', 'OR', '<tablet', 'screen') {
.red {
color: red;
}
} Output @media (min-width: 321px), (max-width: 767px) {
.red {
color: red;
}
}
@media screen and (min-width: 321px), screen and (max-width: 767px) {
.red {
color: red;
}
} |
Why does Additonally, does your implementation support more than one Generally, I still don't really like the
|
@nirazul this is just how sass works by default. See this gist any nested media query is added as an AND query. Also while I agree that the syntax you suggest is better, this would be a big breaking change to include-media. And perhaps harder due to the nature of sass lists - both |
@jackmcpickle
And yes, unfortunately it'd be a big breaking change :( Here's an example output taken from this nice article: Lists in Sass |
@nirazul But agreed maybe a |
Ideally, I'd want a syntax like: @include media(('>medium', '<large'), ('>large', 'retina2x')) {} Which targets anything between I looked into this myself not too long ago and I parked it because I couldn't find a solution that wasn't ridiculously complex and backwards-compatible. |
Maybe I'll find some time this weekend to prepare a PR showing this behaviour. |
Sounds good to me. @eduardoboucas feel free to close. |
I'll leave it open for now. Your approach is perfectly valid, even if it ends up not being the final solution, and your effort is much appreciated. Thanks! |
(See #144) |
Ok its late but here is a WIP PR or addressing #102
Not the nicest solution, but a starting point - Doesn't really fit the guideline
Simplicity is a keyword in include-media, try not to involve too much complexity.
But open to suggestions and comments.Use can see example gist here.