{"name":"postcss-px-to-viewport","description":"A CSS post-processor that converts px to viewport units (vw, vh, vmin, vmax).","version":"0.0.2","author":{"name":"Dmitry Karpunin","email":"koderfunk@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/evrone/postcss-px-to-viewport.git"},"bugs":{"url":"https://github.com/evrone/postcss-px-to-viewport/issues"},"homepage":"https://github.com/evrone/postcss-px-to-viewport","main":"index.js","keywords":["css","units","pixel","px","viewport","vw","vh","vmin","vmax","postcss","postcss-plugin"],"dependencies":{"object-assign":"^4.0.1","postcss":"^5.0.2"},"gitHead":"2b8e75f569a13124439766981d17e625d21df46a","_id":"postcss-px-to-viewport@0.0.2","scripts":{},"_shasum":"726cc95422ebfef34ea2aa04e89f97e4bd5707be","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.4.0","_npmUser":{"name":"koderfunk","email":"koderfunk@gmail.com"},"dist":{"shasum":"726cc95422ebfef34ea2aa04e89f97e4bd5707be","tarball":"http://registry-npm.ywwl.com/postcss-px-to-viewport/download/postcss-px-to-viewport-0.0.2.tgz","integrity":"sha512-yrDzfcDy5kQ1UeckbzdslVm8QtLGna8TZSvk5hV4rzJ6VthAP2xopMH8qL1noAjzRRwcOE9bBSEAL6bmk1MadQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDAxjXsN3ZJWtirKqZdk1lM8zM1m1ZYUAWTNWVWQzuTTAiBKemRAbaqzNpPh5zrj+AOV0LrayW1udnNO+nlAvFENAw=="}],"size":2753,"noattachment":false,"key":"/postcss-px-to-viewport/-/postcss-px-to-viewport-0.0.2.tgz"},"maintainers":[{"name":"koderfunk","email":"koderfunk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/postcss-px-to-viewport-0.0.2.tgz_1456845632236_0.915484358323738"},"directories":{},"readme":"# postcss-px-to-viewport\n[![NPM version](https://badge.fury.io/js/postcss-px-to-viewport.svg)](http://badge.fury.io/js/postcss-px-to-viewport)\n\nEnglish | [中文](README_CN.md) \n\nA plugin for [PostCSS](https://github.com/postcss/postcss) that generates viewport units (vw, vh, vmin, vmax) from pixel units.\n\n<a href=\"https://evrone.com/?utm_source=postcss-px-to-viewport\">\n  <img src=\"https://user-images.githubusercontent.com/417688/34437029-dbfe4ee6-ecab-11e7-9d80-2b274b4149b3.png\"\n       alt=\"Sponsored by Evrone\" width=\"231\">\n</a>\n\n## Demo\n\nIf your project involves a fixed width, this script will help to convert pixels into viewport units.\n\n### Input\n\n```css\n.class {\n  margin: -10px .5vh;\n  padding: 5vmin 9.5px 1px;\n  border: 3px solid black;\n  border-bottom-width: 1px;\n  font-size: 14px;\n  line-height: 20px;\n}\n\n.class2 {\n  border: 1px solid black;\n  margin-bottom: 1px;\n  font-size: 20px;\n  line-height: 30px;\n}\n\n@media (min-width: 750px) {\n  .class3 {\n    font-size: 16px;\n    line-height: 22px;\n  }\n}\n```\n\n### Output\n```css\n.class {\n  margin: -3.125vw .5vh;\n  padding: 5vmin 2.96875vw 1px;\n  border: 0.9375vw solid black;\n  border-bottom-width: 1px;\n  font-size: 4.375vw;\n  line-height: 6.25vw;\n}\n\n.class2 {\n  border: 1px solid black;\n  margin-bottom: 1px;\n  font-size: 6.25vw;\n  line-height: 9.375vw;\n}\n\n@media (min-width: 750px) {\n  .class3 {\n    font-size: 16px;\n    line-height: 22px;\n  }\n}\n```\n\n## Getting Started\n\n### Installation\nAdd via npm\n```\n$ npm install postcss-px-to-viewport --save-dev\n```\nor yarn\n```\n$ yarn add -D postcss-px-to-viewport\n```\n\n### Usage\n\nDefault Options:\n```js\n{\n  unitToConvert: 'px',\n  viewportWidth: 320,\n  unitPrecision: 5,\n  propList: ['*'],\n  viewportUnit: 'vw',\n  fontViewportUnit: 'vw',\n  selectorBlackList: [],\n  minPixelValue: 1,\n  mediaQuery: false,\n  replace: true,\n  exclude: [],\n  landscape: false,\n  landscapeUnit: 'vw',\n  landscapeWidth: 568\n}\n```\n- `unitToConvert` (String) unit to convert, by default, it is px.\n- `viewportWidth` (Number) The width of the viewport.\n- `unitPrecision` (Number) The decimal numbers to allow the vw units to grow to.\n- `propList` (Array) The properties that can change from px to vw.\n  - Values need to be exact matches.\n  - Use wildcard * to enable all properties. Example: ['*']\n  - Use * at the start or end of a word. (['*position*'] will match background-position-y)\n  - Use ! to not match a property. Example: ['*', '!letter-spacing']\n  - Combine the \"not\" prefix with the other prefixes. Example: ['*', '!font*']\n- `viewportUnit` (String) Expected units.\n- `fontViewportUnit` (String) Expected units for font.\n- `selectorBlackList` (Array) The selectors to ignore and leave as px.\n    - If value is string, it checks to see if selector contains the string.\n        - `['body']` will match `.body-class`\n    - If value is regexp, it checks to see if the selector matches the regexp.\n        - `[/^body$/]` will match `body` but not `.body`\n- `minPixelValue` (Number) Set the minimum pixel value to replace.\n- `mediaQuery` (Boolean) Allow px to be converted in media queries.\n- `replace` (Boolean) replaces rules containing vw instead of adding fallbacks.\n- `exclude` (Array or Regexp) Ignore some files like 'node_modules'\n    - If value is regexp, will ignore the matches files.\n    - If value is array, the elements of the array are regexp.\n- `landscape` (Boolean) Adds `@media (orientation: landscape)` with values converted via `landscapeWidth`.\n- `landscapeUnit` (String) Expected unit for `landscape` option\n- `landscapeWidth` (Number) Viewport width for landscape orientation.\n\n#### Use with gulp-postcss\n\nadd to your `gulpfile.js`:\n```js\nvar gulp = require('gulp');\nvar postcss = require('gulp-postcss');\nvar pxtoviewport = require('postcss-px-to-viewport');\n\ngulp.task('css', function () {\n\n    var processors = [\n        pxtoviewport({\n            viewportWidth: 320,\n            viewportUnit: 'vmin'\n        })\n    ];\n\n    return gulp.src(['build/css/**/*.css'])\n        .pipe(postcss(processors))\n        .pipe(gulp.dest('build/css'));\n});\n```\n\n#### Use with PostCss configuration file\n\nadd to your `postcss.config.js`\n```js\nmodule.exports = {\n  plugins: {\n    ...\n    'postcss-px-to-viewport': {\n      // options\n    }\n  }\n}\n```\n\n## Running the tests\n\nIn order to run tests, you need to install `jasmine-node` globally:\n```\n$ npm install jasmine-node -g\n```\nThen run the tests via npm script:\n```\n$ npm run test\n```\n\n## Contributing\n\nPlease read [Code of Conduct](CODE-OF-CONDUCT.md) and [Contributing Guidelines](CONTRIBUTING.md) for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/evrone/postcss-px-to-viewport/tags). \n\n## Changelog\n\nThe changelog is [here](CHANGELOG.md).\n\n## Authors\n\n* [Dmitry Karpunin](https://github.com/KODerFunk) - *Initial work*\n* [Ivan Bunin](https://github.com/chernobelenkiy)\n\nSee also the list of [contributors](https://github.com/evrone/postcss-px-to-viewport/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Acknowledgments\n\n* Hat tip to https://github.com/cuth/postcss-pxtorem/ for inspiring us for this project.\n","publish_time":1456845635701,"_cnpm_publish_time":1456845635701,"dist-tags":{"latest":"1.1.1"}}