Skip to content

Instantly share code, notes, and snippets.

@ericfreese
Created January 25, 2017 21:35
Show Gist options
  • Save ericfreese/4376932b244c98e4213ca41e2e86eb2e to your computer and use it in GitHub Desktop.
Save ericfreese/4376932b244c98e4213ca41e2e86eb2e to your computer and use it in GitHub Desktop.
Stylus media query mixin
mq(from = null, to = null) {
width-query = null
if from {
width-query = 'min-width: ' + (from + 1px)
}
if to {
to-query = 'max-width: ' + to
if width-query {
width-query = width-query + ') and (' + to-query
} else {
width-query = to-query
}
}
if width-query {
@media ({width-query}) {
{block}
}
} else {
{block}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment