UNPKG

easy-query

Version:

An easy to use, easy to customize sheet of SCSS media queries tailored for use alongside or without popular frameworks such as Bootstrap and Foundation.

3 lines (2 loc) 7.32 kB
"use strict";var fs=require("fs");module.exports=function(n){function e(n,e){return"-range: ("+n[e]+"rem, "+(n[e+1]-a)+"rem);\n"}function d(n){var d="$xs",t="$sm",i="$md",r="$lg",m="$xl",s="$xx";switch(n.length){case 1:o+=t+"-only: '#{$screen} and (max-width: "+(n[0]-a)+"rem)';\n"+r+"-only: '#{$screen} and (min-width: "+n[0]+"rem)';\n\n.sm-only {\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-only {\n\t@media #{"+t+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n";break;case 2:o+=i+e(n,0)+t+"-only: '#{$screen} and (max-width: "+(n[0]-a)+"rem)';\n"+i+"-only: '#{$screen} and (min-width: "+n[0]+"rem) and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-only: '#{$screen} and (min-width: "+n[1]+"rem)';\n"+i+"-up: '#{$screen} and (min-width: "+n[0]+"rem)';\n"+i+"-down: '#{$screen} and (max-width: #{upper-bound("+i+"-range)})';\n\n.sm-only {\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-only {\n\t@media #{"+t+"-only} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-only {\n\t@media #{"+i+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-up {\n\t@media #{"+t+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-down {\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n";break;case 3:o+=t+e(n,0)+i+e(n,1)+d+"-only: '#{$screen} and (max-width: "+(n[0]-a)+"rem)';\n"+t+"-only: '#{$screen} and (min-width: "+n[0]+"rem) and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-only: '#{$screen} and (min-width: "+n[1]+"rem) and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-only: '#{$screen} and (min-width: "+n[2]+"rem)';\n"+t+"-up: '#{$screen} and (min-width: "+n[0]+"rem)';\n"+i+"-up: '#{$screen} and (min-width: "+n[1]+"rem)';\n"+t+"-down: '#{$screen} and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-down: '#{$screen} and (max-width: #{upper-bound("+i+"-range)})';\n\n.xs-only {\n\t@media #{"+t+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-only {\n\t@media #{"+d+"-only} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-only {\n\t@media #{"+t+"-down} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-only {\n\t@media #{"+i+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-up {\n\t@media #{"+d+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-up {\n\t@media #{"+t+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-down {\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-down {\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n";break;case 4:o+=t+e(n,0)+i+e(n,1)+r+e(n,2)+d+"-only: '#{$screen} and (max-width: "+(n[0]-a)+"rem)';\n"+t+"-only: '#{$screen} and (min-width: "+n[0]+"rem) and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-only: '#{$screen} and (min-width: "+n[1]+"rem) and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-only: '#{$screen} and (min-width: "+n[2]+"rem) and (max-width: #{upper-bound("+r+"-range)})';\n"+m+"-only: '#{$screen} and (min-width: "+n[3]+"rem)';\n"+t+"-up: '#{$screen} and (min-width: "+n[0]+"rem)';\n"+i+"-up: '#{$screen} and (min-width: "+n[1]+"rem)';\n"+r+"-up: '#{$screen} and (min-width: "+n[2]+"rem)';\n"+t+"-down: '#{$screen} and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-down: '#{$screen} and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-down: '#{$screen} and (max-width: #{upper-bound("+r+"-range)})';\n\n.xs-only {\n\t@media #{"+t+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-only {\n\t@media #{"+d+"-only} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-only {\n\t@media #{"+t+"-down} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+r+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-only {\n\t@media #{"+i+"-down} {\n\t\tdisplay: none;\n\t}\n\t@media #{"+m+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.xl-only {\n\t@media #{"+r+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-up {\n\t@media #{"+d+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-up {\n\t@media #{"+t+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-up {\n\t@media #{"+i+"-down} {\n\t\tdisplay: none;\n\t}\n}\n\n.sm-down {\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-down {\n\t@media #{"+r+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-down {\n\t@media #{"+m+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n";break;case 5:o+=t+e(n,0)+i+e(n,1)+r+e(n,2)+m+e(n,3)+d+"-only: '#{$screen} and (max-width: "+(n[0]-a)+"rem)';\n"+t+"-only: '#{$screen} and (min-width: "+n[0]+"rem) and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-only: '#{$screen} and (min-width: "+n[1]+"rem) and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-only: '#{$screen} and (min-width: "+n[2]+"rem) and (max-width: #{upper-bound("+r+"-range)})';\n"+m+"-only: '#{$screen} and (min-width: "+n[3]+"rem) and (max-width: #{upper-bound("+m+"-range)})';\n"+s+"-only: '#{$screen} and (min-width: "+n[4]+"rem);\n"+t+"-up: '#{$screen} and (min-width: "+n[3]+"rem)';\n"+i+"-up: '#{$screen} and (min-width: "+n[3]+"rem)';\n"+r+"-up: '#{$screen} and (min-width: "+n[2]+"rem)';\n"+m+"-up: '#{$screen} and (min-width: "+n[3]+"rem)';\n"+t+"-down: '#{$screen} and (max-width: #{upper-bound("+t+"-range)})';\n"+i+"-down: '#{$screen} and (max-width: #{upper-bound("+i+"-range)})';\n"+r+"-down: '#{$screen} and (max-width: #{upper-bound("+r+"-range)})';\n"+m+"-down: '#{$screen} and (max-width: #{upper-bound("+m+"-range)})';\n\n.xs-only {\n@media #{"+t+"-up} {\ndisplay: none;\n}\n}\n\n.sm-only {\n@media #{"+d+"-only} {\ndisplay: none;\n}\n\t@media #{"+i+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.md-only {\n@media #{"+t+"-down} {\ndisplay: none;\n}\n\t@media #{"+r+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.lg-only {\n@media #{"+i+"-down} {\ndisplay: none;\n}\n\t@media #{"+m+"-up} {\n\t\tdisplay: none;\n\t}\n}\n\n.xl-only {\n@media #{"+r+"-down} {\ndisplay: none;\n}\n\t@media #{"+s+"-only} {\n\t\tdisplay: none;\n\t}\n}\n\n.xx-only {\n@media #{"+m+"-down} {\ndisplay: none;\n}\n}\n\n.sm-up {\n@media #{"+d+"-only} {\ndisplay: none;\n}\n}\n\n.md-up {\n@media #{"+t+"-down} {\ndisplay: none;\n}\n}\n\n.lg-up {\n@media #{"+i+"-down} {\ndisplay: none;\n}\n}\n\n.xl-up {\n@media #{"+r+"-down} {\ndisplay: none;\n}\n}\n\n.sm-down {\n@media #{"+i+"-up} {\ndisplay: none;\n}\n}\n\n.md-down {\n@media #{"+r+"-only} {\ndisplay: none;\n}\n}\n\n.lg-down {\n@media #{"+m+"-only} {\ndisplay: none;\n}\n}\n\n.xl-down {\n@media #{"+s+"-only} {\ndisplay: none;\n}\n}\n\n"}}var t,a=.0625,o="$screen: 'only screen' !default;\n\n@function lower-bound($range) {\n\n\t@if length($range) <= 0 {\n\t\t@return 0;\n\t}\n\n\t@return nth($range, 1);\n}\n\n@function upper-bound($range) {\n\n \t@if length($range) < 2 {\n\t\t@return 999999999999;\n \t}\n\n\t@return nth($range, 2);\n}\n\n";if(0!==arguments.length&&1!==arguments.length)throw new Error("Too many arguments passed to EasyQuery. Expected 0 or 1, got "+arguments.length);if(1===arguments.length&&"string"==typeof arguments[0]||1===arguments.length&&arguments[0].constructor===Array)try{"string"==typeof arguments[0]?t=require("./frameworks/"+n):arguments[0].constructor===Array&&(t=arguments[0].sort()),d(t),console.dir(t)}catch(i){throw new Error("Could not parse library: "+n+". Does it exist? Error message: "+i)}else t=require("./frameworks/bootstrap3"),d(t);fs.writeFile("./_easy-query.scss",o,function(n){if(n)throw new Error("Could not write _easy-query.scss. Error message: "+n)})}; //# sourceMappingURL=easy-query.min.js.map