json2mq
Generate media query string from JSON or javascript object
Last updated 10 years ago by akiran .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install json2mq 
SYNC missed versions from official npm registry.

json2mq

json2mq is used to generate media query string from JSON or javascript object.

Install

npm install json2mq

Usage

var json2mq = require('json2mq');
json2mq({minWidth: 100, maxWidth: 200});
// -> '(min-width: 100px) and (max-width: 200px)'
  • Media type
json2mq({screen: true});  // -> 'screen'
  • Media type with negation
json2mq({handheld: false});  // -> 'not handheld'
  • Media features can be specified in camel case
json2mq({minWidth: 100, maxWidth: 200});
// -> '(min-width: 100px) and (max-width: 200px)'
  • px is added to numeric dimension values
json2mq({minWidth: 100, maxWidth: '20em'});
// -> '(min-width: 100px) and (max-width: 20em)'
  • Multiple media queries can be passed as an array
json2mq([{screen: true, minWidth: 100}, {handheld: true, orientation: 'landscape'}]); 
// -> 'screen and (min-width: 100px), handheld and (orientation: landscape)'

Contributors

  • Eric Schoffstall

Current Tags

  • 0.2.0                                ...           latest (10 years ago)

2 Versions

  • 0.2.0                                ...           10 years ago
  • 0.1.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 11
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE