Created
January 25, 2017 21:35
-
-
Save ericfreese/4376932b244c98e4213ca41e2e86eb2e to your computer and use it in GitHub Desktop.
Stylus media query mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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