Human-friendly media queries for Sass.
IMPORTANT NOTICE: this project is deprecated and unmaintained. I no longer think that this simplifies working with media queries since it only adds an unnecessary abstraction layer.
A set of mixins that attempts to make working with media queries a bit easier by using memorable names to define them.
Install it using npm:
npm install friendly-queries
- Basic usage:
selector {
property: value;
@include viewport-above(small) {
property: value;
}
}
Output:
selector {
property: value;
}
@media (min-width: 48em) {
selector {
property: value;
}
}
- Modify the direction:
selector {
property: value;
@include device-below(large, vertical) {
property: value;
}
}
Output:
selector {
property: value;
}
@media (min-device-height: 64em) {
selector {
property: value;
}
}
- Nesting:
selector {
property: value;
@include viewport-above(small) {
property: value;
@include orientation(portrait) {
property: value;
}
}
}
Output:
selector {
property: value;
}
@media (min-width: 48em) {
selector {
property: value;
}
}
@media (min-width: 48em) and (orientation: portrait) {
selector {
property: value;
}
}
You can see it in action on the test page.
density-above()
density-below()
density-between()
device-above()
device-below()
device-between()
orientation()
print()
viewport-above()
viewport-below()
viewport-between()
Define the different conditions for the media queries inside the
$friendly-queries
map.
Contributions are welcome! Please, read the contribution guidelines first.
Released under the MIT license.