Media Queries, with a Jacket
mq()
is a Sass component that helps manipulating media queries in an elegant way.
This add-on mixin uses Jacket, as a pragmatic alternative to $mq-static-breakpoint
, to rasterize @media
queries. This allows you to be fastidious as to which @media
context should be rasterized, instead of relying on a named-breakpoint representing a specific layout range.
Installation
With Bower
bower install jacket --save-dev
bower install mcaskill/sass-mq --save-dev
bower install jacket-mq=https://gist.github.com/mcaskill/89944b7ef12f37c85c05.git --save-dev
Or Download
Basic Usage
Import the three in your stylesheet, in the respective order above. Follow the instructions outlined in mq()
for setting up the mixin. Remove any preferences for $mq-responsive
and $mq-static-breakpoint
.
mj()
uses two variables that can be overriden in your own preferences before the _mj
file is imported:
$mq-jacket-support
: Context for those that support@media
queries. Defaults tohas-mediaqueries
.$mq-jacket-legacy
: Context for those that don't support@media
. Defaults tohas-no-mediaqueries
.
Afterwards, follow the instructions outlined in Jacket to define your contexts.
$jacket: $mq-jacket-legacy, ie8;
// [...]
#foo {
content: 'Basic Styling';
// This won't be compiled:
@include mq($from: mobile) {
color: lawngreen;
}
// This will be compiled:
@include mj($until: tablet) {
color: indianred;
}
}