Last active
August 29, 2015 14:00
-
-
Save dflynn15/a4d13309f424e35a997f to your computer and use it in GitHub Desktop.
Conditional Media Query Mixin for LESS.
This file contains 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
/* | |
* This is a LESS port of Sparkbox's module-based media queries mixin in SASS | |
* https://github.com/sparkbox/SB-Media | |
* | |
* Example use: http://codepen.io/dflynn15/pen/AHadk | |
* body{ | |
* background-color:red; | |
* | |
* .sb-media(40em ,{ | |
* background-color: blue; | |
* }); | |
* } | |
*/ | |
@no-mq-support: 'false'; | |
@no-mq-threshold: 60em; | |
.sb-media(@query, @rules) when (@no-mq-support = 'false'){ | |
@media all and (min-width: @query) { @rules(); } | |
} | |
.sb-media(@query, @rules) when (@no-mq-support = 'true') and (@query < @no-mq-threshold){ | |
@rules(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment