{"_id":"@alitajs/postcss-plugin-px2rem","_rev":"3-3e66124c403989f204192f8d69e631bb","name":"@alitajs/postcss-plugin-px2rem","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@alitajs/postcss-plugin-px2rem","version":"0.0.1","description":"A plugin for PostCSS that generates rem units from multi units.","main":"index.js","scripts":{"compile":"rm -rf lib && babel -d lib src","compile:watch":"npm run compile -- --watch","lint":"eslint src test","prepublish":"npm run compile","test":"babel-node $(npm bin)/babel-istanbul cover $(npm bin)/_mocha -- --no-timeouts","coveralls":"cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/alitajs/postcss-plugin-px2rem.git"},"keywords":["px","rem","postcss","plugin"],"author":{"name":"pigcan","email":"jiangjay818@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ant-tool/postcss-plugin-px2rem/issues"},"homepage":"https://github.com/ant-tool/postcss-plugin-px2rem#readme","dependencies":{"postcss":"^5.0.21"},"devDependencies":{"babel-cli":"^6.7.5","babel-core":"^6.7.6","babel-eslint":"^6.0.2","babel-istanbul":"^0.7.0","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","coveralls":"^2.11.9","eslint":"^2.7.0","eslint-config-airbnb":"^6.2.0","expect":"^1.20.1","mocha":"^2.4.5"},"publishConfig":{"access":"public"},"gitHead":"8e842477d4a1f4e9f77fad490cbd56957eb21264","_id":"@alitajs/postcss-plugin-px2rem@0.0.1","_nodeVersion":"14.16.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-kT28fFv++2yjcKgpoKG0Hj/SOIuqak0obP1ddcLOxMrZ/FmOYfTHzpwQg7rmGRtdC04p4f3gknKYB7SETBWGkg==","shasum":"c360752890ea088c8ab9e765af1d2784e2f3c5ae","tarball":"https://registry.npmjs.org/@alitajs/postcss-plugin-px2rem/-/postcss-plugin-px2rem-0.0.1.tgz","fileCount":5,"unpackedSize":11664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJKRFCRA9TVsSAnZWagAAhzIP+wc4AJfypVPhM6TbAa2b\nhQ4zwXGSNVb5sa+oVZ/AITxtF0RZ6R8D0n7PBSpxj569/oYowGFBGaAEkZFo\n/BMLidf7JJsaMxe/a4Dk3cAQCbjH9dXFncdZk7+UHAC8DjGe6mLFw72OuB39\nt/G5k/b2nxKe/GPE27gX0qtqaT2l2AFrJ46AcsEUGYyHU0MsYX/etEwrlgw6\nrF9n1QakqXv4VAQKBZQ+DDMH3TWAeoT4Bu1fphxq/qOAsLXXi6A+fHua703G\nDtICibIokGgIMEBjSVLUu5MFE7g1nC3Qsg7pvVoA1pYaieHADhDEnpT7RQTu\nei6RPU8JRxoYLrVmb4xiMByyx46LTLtCBEsEbNlrQc1/vK9vJowQFZCrbeRb\nqnibEM1k1ffHY3j31kDGzD3Mib29Siv6QLIOxVJp2lubYdGOddbz0sX1aEb+\nKVi8v+42yDCVpwDegibtQ4jZ4k6Dhwe27MastIQQuBY86mm4QtAS+dJu6+ts\n+gYhEDG/4TkHuwxYbguNebdgKUOpBR1n310GVOIdwoFtDicXHGMeVHSWjBY+\n7H+cB5d5YWlR9BMFK6pXrZAqb4LJb2CjIYYjcXfuR9QqfQsFYYs+xHzKexaT\nA6js+7ZIhjz/YDRaqftoNwrDWilHsKB/zSZ8qt83LRbFV7IVjdTTs2nlt6B2\nTJY7\r\n=wjOb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtj4DPuhkC6BRQG5Z++xiMbWiL2DHwflpGVj7QgNlBeAiB0GlWDooVHo4Q9xvRONMaSI/Nf5ePy86dwAk1oQgK3BQ=="}]},"_npmUser":{"name":"xiaohuoni","email":"448627663@qq.com"},"directories":{},"maintainers":[{"name":"diyc","email":"13067111941x@gmail.com"},{"name":"xiaohuoni","email":"448627663@qq.com"},{"name":"imhele","email":"work@imhele.com"},{"name":"wangxingkang","email":"156148958@qq.com"},{"name":"shawdanon","email":"shawdanon@foxmail.com"},{"name":"cjy0208","email":"fanluan058@gmail.com"},{"name":"sorrycc","email":"sorrycc@gmail.com"},{"name":"hang1017","email":"437132124@qq.com"},{"name":"hammersjs","email":"1270253618@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postcss-plugin-px2rem_0.0.1_1629791301707_0.48381731538664385"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-24T07:48:21.640Z","0.0.1":"2021-08-24T07:48:21.830Z","modified":"2022-06-07T09:42:44.218Z"},"maintainers":[{"email":"pt370390794@126.com","name":"pengyh"},{"email":"savebtc11@gmail.com","name":"ashoka_j"},{"email":"13067111941x@gmail.com","name":"diyc"},{"email":"448627663@qq.com","name":"xiaohuoni"},{"email":"work@imhele.com","name":"imhele"},{"email":"156148958@qq.com","name":"wangxingkang"},{"email":"292973338@qq.com","name":"shawdanon"},{"email":"fanluan058@gmail.com","name":"cjy0208"},{"email":"sorrycc@gmail.com","name":"sorrycc"},{"email":"437132124@qq.com","name":"hang1017"},{"email":"1270253618@qq.com","name":"hammersjs"}],"description":"A plugin for PostCSS that generates rem units from multi units.","homepage":"https://github.com/ant-tool/postcss-plugin-px2rem#readme","keywords":["px","rem","postcss","plugin"],"repository":{"type":"git","url":"git+https://github.com/alitajs/postcss-plugin-px2rem.git"},"author":{"name":"pigcan","email":"jiangjay818@gmail.com"},"bugs":{"url":"https://github.com/ant-tool/postcss-plugin-px2rem/issues"},"license":"MIT","readme":"# postcss-plugin-px2rem\n\n[![NPM version](https://img.shields.io/npm/v/postcss-plugin-px2rem.svg?style=flat)](https://npmjs.org/package/postcss-plugin-px2rem)\n[![Build Status](https://img.shields.io/travis/ant-tool/postcss-plugin-px2rem.svg?style=flat)](https://travis-ci.org/ant-tool/postcss-plugin-px2rem)\n[![Coverage Status](https://img.shields.io/coveralls/ant-tool/postcss-plugin-px2rem.svg?style=flat)](https://coveralls.io/r/ant-tool/postcss-plugin-px2rem)\n[![NPM downloads](http://img.shields.io/npm/dm/postcss-plugin-px2rem.svg?style=flat)](https://npmjs.org/package/postcss-plugin-px2rem)\n[![Dependency Status](https://david-dm.org/ant-tool/postcss-plugin-px2rem.svg)](https://david-dm.org/ant-tool/postcss-plugin-px2rem)\n\npostcss plugin px2rem.\n\n<img align=\"right\" width=\"135\" height=\"95\"\n     title=\"Philosopher’s stone, logo of PostCSS\"\n     src=\"http://postcss.github.io/postcss/logo-leftp.svg\">\n\n## Features\n\nA plugin for PostCSS that generates rem units from pixel units.\n\n## Installation\n\n```bash\n$ npm i --save postcss-plugin-px2rem\n```\n\n## Usage\n\n### input and output\n\n```css\n// input\nh1 {\n  margin: 0 0 20px;\n  font-size: 32px;\n  line-height: 1.2;\n  letter-spacing: 1px;\n}\n\n// output\nh1 {\n  margin: 0 0 0.2rem;\n  font-size: 0.32rem;\n  line-height: 1.2;\n  letter-spacing: 0.01rem;\n}\n```\n\n### original\n\n```javascript\nimport { writeFile, readFileSync } from 'fs';\nimport postcss from 'postcss';\nimport pxtorem from 'postcss-plugin-px2rem';\n\nconst css = readFileSync('/path/to/test.css', 'utf8');\nconst options = {\n  replace: false,\n};\nconst processedCss = postcss(pxtorem(options)).process(css).css;\n\nwriteFile('/path/to/test.rem.css', processedCss, err => {\n  if (err) throw err;\n  console.log('Rem file written.');\n});\n```\n\n### with webpack\n\n```javascript\nimport px2rem from 'postcss-plugin-px2rem';\nconst px2remOpts = {\n  ......\n};\n \nexport default {\n  module: {\n    loaders: [\n      {\n        test: /\\.css$/,\n        loader: 'style-loader!css-loader!postcss-loader',\n      },\n    ],\n  },\n  postcss: [px2rem(px2remOpts)],\n}\n```\n\n### with [atool-build](https://github.com/ant-tool/atool-build)\n\n`webpack.connfig.js`\n\n```javascript\nimport webpack from 'atool-build/lib/webpack';\nimport px2rem from 'postcss-plugin-px2rem';\n\nexport default webpackConfig => {\n  const px2remOpts = {\n    ......\n  };\n  webpackConfig.postcss.push(px2rem(px2remOpts));\n\n  return webpackConfig;\n};\n```\n\n## Configuration\n\nDefault:\n```js\n{\n  rootValue: 100,\n  unitPrecision: 5,\n  propWhiteList: [],\n  propBlackList: [],\n  exclude:false,\n  selectorBlackList: [],\n  ignoreIdentifier: false,\n  replace: true,\n  mediaQuery: false,\n  minPixelValue: 0\n}\n```\n\n- `rootValue` (Number|Object) The root element font size. Default is 100.\n    - If rootValue is an object, for example `{ px: 50, rpx: 100 }`, it will\n    replace rpx to 1/100 rem , and px to 1/50 rem.\n- `unitPrecision` (Number) The decimal numbers to allow the REM units to grow to.\n- `propWhiteList` (Array) The properties that can change from px to rem.\n    - Default is an empty array that means disable the white list and enable all properties.\n    - Values need to be exact matches.\n- `propBlackList` (Array) The properties that should not change from px to rem.\n    - Values need to be exact matches.\n- `exclude` (Reg)  a way to exclude some folder,eg. /(node_module)/.\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- `ignoreIdentifier` (Boolean/String)  a way to have a single property ignored, when ignoreIdentifier enabled, then `replace` would be set to `true` automatically.\n- `replace` (Boolean) replaces rules containing rems instead of adding fallbacks.\n- `mediaQuery` (Boolean) Allow px to be converted in media queries.\n- `minPixelValue` (Number) Set the minimum pixel value to replace.\n\n### License\nMIT\n","readmeFilename":"README.md"}