{"_id":"@766aya/postcss-px-to-viewport","name":"@766aya/postcss-px-to-viewport","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.1":{"name":"@766aya/postcss-px-to-viewport","description":"A CSS post-processor that converts px to viewport units (vw, vh, vmin, vmax).","version":"1.1.1","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","scripts":{"test":"jasmine-node spec"},"devDependencies":{"jasmine-node":"~1.11.0"},"private":false,"keywords":["css","units","pixel","px","viewport","vw","vh","vmin","vmax","postcss","postcss-plugin"],"dependencies":{"object-assign":">=4.0.1","postcss":">=5.0.2"},"gitHead":"40da73adf24d85693aa0650766c14c768d69569d","_id":"@766aya/postcss-px-to-viewport@1.1.1","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-V9ADXvHbJ8BqvKxVbWp8o6GMlav8FUSwZzewr2N6hlvGqAoTdHQug6kK2/zN9bO5h4pbQNqOLB7OJKq/+pJRxw==","shasum":"a410851ad924f96014cb82a91d3e44c2b41d604f","tarball":"https://registry.npmjs.org/@766aya/postcss-px-to-viewport/-/postcss-px-to-viewport-1.1.1.tgz","fileCount":13,"unpackedSize":28522,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/gyrfiHxZQ5vZtfmzWyecr2fFvqAs8c+k7vermbvFMgIgVn8V4LFT/EIgtTPeAwIjKdyqHJIYvXnihVyc6fiiRXQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSiH0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpUBxAAiOg/4EvjVOG8s8PCEK9LtFltoJSZrDqtck2nSjO6wrtmD4Rg\r\n2alJmxpmqTa5b1helgl3wNRMcpUGPERJW/hcIhWU8kRnStmRMXQUyecXY5tu\r\ni3gvkCcdAPLwR2pcKiwOWqonASXIzCtFKy9tiN0fHp0pcLmgdKPnlN2MDQcR\r\n/vZd63lJDJ7xTpp+3PLVvp6oCBjRNkfQPp9Ja/rErzjv2V3ISety1kKziwkB\r\nCSdXBwY8zpYe2qDwdOVAVGM3Z4CuLt03vnHhmfWPHzT7p2iB7L/Fc8ricl14\r\nN+00DU+tAkdRr2UkrnQgl+DZzPvyFzikwaElSj6nQchvx6kfe90HljdqHPP8\r\n4WhGOVkDvKduSy6XJHLLhZwkOhycxx/bUTKoBZbDcE9VcF71nYKFfi4rtILu\r\nbu4sVimGHeBexsrXdAZ0LrOPi9ID971As6RCQE/itrhDy6vQZhDzGK6T/t5O\r\n0YtJg6rmZsYWYn+pw7+GXOnfykX5vU3lcK7hQfWHQ1zH8LiADMYCbPA8q3gl\r\nYY7pNqEUiS5MBFBWkN6ePJ2Lanok/X6eDcgKSmaJc2gW8+AID7RKg0Zn9fH+\r\nBSSRDwENknJmLkTF9Ouq3UuQg6f12kG9L3fWm1TDn66vh4gmCuKFdFQk3hAG\r\n7q9rUiooGfJi2v3n3ulaTFu8YS25IvGiaAQ=\r\n=pIPI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"766aya","email":"1494233259@qq.com"},"directories":{},"maintainers":[{"name":"766aya","email":"1494233259@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postcss-px-to-viewport_1.1.1_1682579956019_0.3190924242072217"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-27T07:19:15.967Z","1.1.1":"2023-04-27T07:19:16.215Z","modified":"2023-04-27T07:19:16.370Z"},"maintainers":[{"name":"766aya","email":"1494233259@qq.com"}],"description":"A CSS post-processor that converts px to viewport units (vw, vh, vmin, vmax).","homepage":"https://github.com/evrone/postcss-px-to-viewport","keywords":["css","units","pixel","px","viewport","vw","vh","vmin","vmax","postcss","postcss-plugin"],"repository":{"type":"git","url":"git+ssh://git@github.com/evrone/postcss-px-to-viewport.git"},"author":{"name":"Dmitry Karpunin","email":"koderfunk@gmail.com"},"bugs":{"url":"https://github.com/evrone/postcss-px-to-viewport/issues"},"license":"MIT","readme":"# postcss-px-to-viewport\r\n[![NPM version](https://badge.fury.io/js/postcss-px-to-viewport.svg)](http://badge.fury.io/js/postcss-px-to-viewport)\r\n\r\nEnglish | [中文](README_CN.md) \r\n\r\nA plugin for [PostCSS](https://github.com/postcss/postcss) that generates viewport units (vw, vh, vmin, vmax) from pixel units.\r\n\r\n<a href=\"https://evrone.com/?utm_source=postcss-px-to-viewport\">\r\n  <img src=\"https://user-images.githubusercontent.com/417688/34437029-dbfe4ee6-ecab-11e7-9d80-2b274b4149b3.png\"\r\n       alt=\"Sponsored by Evrone\" width=\"231\">\r\n</a>\r\n\r\n## Demo\r\n\r\nIf your project involves a fixed width, this script will help to convert pixels into viewport units.\r\n\r\n### Input\r\n\r\n```css\r\n.class {\r\n  margin: -10px .5vh;\r\n  padding: 5vmin 9.5px 1px;\r\n  border: 3px solid black;\r\n  border-bottom-width: 1px;\r\n  font-size: 14px;\r\n  line-height: 20px;\r\n}\r\n\r\n.class2 {\r\n  border: 1px solid black;\r\n  margin-bottom: 1px;\r\n  font-size: 20px;\r\n  line-height: 30px;\r\n}\r\n\r\n@media (min-width: 750px) {\r\n  .class3 {\r\n    font-size: 16px;\r\n    line-height: 22px;\r\n  }\r\n}\r\n```\r\n\r\n### Output\r\n```css\r\n.class {\r\n  margin: -3.125vw .5vh;\r\n  padding: 5vmin 2.96875vw 1px;\r\n  border: 0.9375vw solid black;\r\n  border-bottom-width: 1px;\r\n  font-size: 4.375vw;\r\n  line-height: 6.25vw;\r\n}\r\n\r\n.class2 {\r\n  border: 1px solid black;\r\n  margin-bottom: 1px;\r\n  font-size: 6.25vw;\r\n  line-height: 9.375vw;\r\n}\r\n\r\n@media (min-width: 750px) {\r\n  .class3 {\r\n    font-size: 16px;\r\n    line-height: 22px;\r\n  }\r\n}\r\n```\r\n\r\n## Getting Started\r\n\r\n### Installation\r\nAdd via npm\r\n```\r\n$ npm install postcss-px-to-viewport --save-dev\r\n```\r\nor yarn\r\n```\r\n$ yarn add -D postcss-px-to-viewport\r\n```\r\n\r\n### Usage\r\n\r\nDefault Options:\r\n```js\r\n{\r\n  unitToConvert: 'px',\r\n  viewportWidth: 320,\r\n  unitPrecision: 5,\r\n  propList: ['*'],\r\n  viewportUnit: 'vw',\r\n  fontViewportUnit: 'vw',\r\n  selectorBlackList: [],\r\n  minPixelValue: 1,\r\n  mediaQuery: false,\r\n  replace: true,\r\n  exclude: [],\r\n  landscape: false,\r\n  landscapeUnit: 'vw',\r\n  landscapeWidth: 568\r\n}\r\n```\r\n- `unitToConvert` (String) unit to convert, by default, it is px.\r\n- `viewportWidth` (Number) The width of the viewport.\r\n- `unitPrecision` (Number) The decimal numbers to allow the vw units to grow to.\r\n- `propList` (Array) The properties that can change from px to vw.\r\n  - Values need to be exact matches.\r\n  - Use wildcard * to enable all properties. Example: ['*']\r\n  - Use * at the start or end of a word. (['*position*'] will match background-position-y)\r\n  - Use ! to not match a property. Example: ['*', '!letter-spacing']\r\n  - Combine the \"not\" prefix with the other prefixes. Example: ['*', '!font*']\r\n- `viewportUnit` (String) Expected units.\r\n- `fontViewportUnit` (String) Expected units for font.\r\n- `selectorBlackList` (Array) The selectors to ignore and leave as px.\r\n    - If value is string, it checks to see if selector contains the string.\r\n        - `['body']` will match `.body-class`\r\n    - If value is regexp, it checks to see if the selector matches the regexp.\r\n        - `[/^body$/]` will match `body` but not `.body`\r\n- `minPixelValue` (Number) Set the minimum pixel value to replace.\r\n- `mediaQuery` (Boolean) Allow px to be converted in media queries.\r\n- `replace` (Boolean) replaces rules containing vw instead of adding fallbacks.\r\n- `exclude` (Array or Regexp) Ignore some files like 'node_modules'\r\n    - If value is regexp, will ignore the matches files.\r\n    - If value is array, the elements of the array are regexp.\r\n- `landscape` (Boolean) Adds `@media (orientation: landscape)` with values converted via `landscapeWidth`.\r\n- `landscapeUnit` (String) Expected unit for `landscape` option\r\n- `landscapeWidth` (Number) Viewport width for landscape orientation.\r\n\r\n#### Use with gulp-postcss\r\n\r\nadd to your `gulpfile.js`:\r\n```js\r\nvar gulp = require('gulp');\r\nvar postcss = require('gulp-postcss');\r\nvar pxtoviewport = require('postcss-px-to-viewport');\r\n\r\ngulp.task('css', function () {\r\n\r\n    var processors = [\r\n        pxtoviewport({\r\n            viewportWidth: 320,\r\n            viewportUnit: 'vmin'\r\n        })\r\n    ];\r\n\r\n    return gulp.src(['build/css/**/*.css'])\r\n        .pipe(postcss(processors))\r\n        .pipe(gulp.dest('build/css'));\r\n});\r\n```\r\n\r\n#### Use with PostCss configuration file\r\n\r\nadd to your `postcss.config.js`\r\n```js\r\nmodule.exports = {\r\n  plugins: {\r\n    ...\r\n    'postcss-px-to-viewport': {\r\n      // options\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## Running the tests\r\n\r\nIn order to run tests, you need to install `jasmine-node` globally:\r\n```\r\n$ npm install jasmine-node -g\r\n```\r\nThen run the tests via npm script:\r\n```\r\n$ npm run test\r\n```\r\n\r\n## Contributing\r\n\r\nPlease read [Code of Conduct](CODE-OF-CONDUCT.md) and [Contributing Guidelines](CONTRIBUTING.md) for submitting pull requests to us.\r\n\r\n## Versioning\r\n\r\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). \r\n\r\n## Changelog\r\n\r\nThe changelog is [here](CHANGELOG.md).\r\n\r\n## Authors\r\n\r\n* [Dmitry Karpunin](https://github.com/KODerFunk) - *Initial work*\r\n* [Ivan Bunin](https://github.com/chernobelenkiy)\r\n\r\nSee also the list of [contributors](https://github.com/evrone/postcss-px-to-viewport/contributors) who participated in this project.\r\n\r\n## License\r\n\r\nThis project is licensed under the [MIT License](LICENSE).\r\n\r\n## Acknowledgments\r\n\r\n* Hat tip to https://github.com/cuth/postcss-pxtorem/ for inspiring us for this project.\r\n","readmeFilename":"README.md"}