You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 3 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # json2mq
  2. json2mq is used to generate media query string from JSON or javascript object.
  3. ## Install
  4. npm install json2mq
  5. ## Usage
  6. ```javascript
  7. var json2mq = require('json2mq');
  8. json2mq({minWidth: 100, maxWidth: 200});
  9. // -> '(min-width: 100px) and (max-width: 200px)'
  10. ```
  11. * Media type
  12. ```javascript
  13. json2mq({screen: true}); // -> 'screen'
  14. ```
  15. * Media type with negation
  16. ```javascript
  17. json2mq({handheld: false}); // -> 'not handheld'
  18. ```
  19. * Media features can be specified in camel case
  20. ```javascript
  21. json2mq({minWidth: 100, maxWidth: 200});
  22. // -> '(min-width: 100px) and (max-width: 200px)'
  23. ```
  24. * px is added to numeric dimension values
  25. ```javascript
  26. json2mq({minWidth: 100, maxWidth: '20em'});
  27. // -> '(min-width: 100px) and (max-width: 20em)'
  28. ```
  29. * Multiple media queries can be passed as an array
  30. ```javascript
  31. json2mq([{screen: true, minWidth: 100}, {handheld: true, orientation: 'landscape'}]);
  32. // -> 'screen and (min-width: 100px), handheld and (orientation: landscape)'
  33. ```
  34. ## Contributors
  35. * Eric Schoffstall