{"name":"px2rem","description":"According to one stylesheet, generate rem version and @1x, @2x and @3x stylesheet","version":"0.4.2","homepage":"https://github.com/songsiqi/px2rem","author":{"name":"songsiqi","email":"songsiqi2006@126.com"},"contributors":[{"name":"hongru","email":"hongru.chenhr@gmail.com"}],"repository":{"type":"git","url":"git@github.com:songsiqi/px2rem.git"},"engines":{"node":">= 0.10.0"},"dependencies":{"css":"~2.2.0","extend":"~2.0.0","commander":"~2.6.0","chalk":"~0.5.1","fs-extra":"~0.16.3"},"devDependencies":{"istanbul":"^0.3.6","coveralls":"^2.10.0","mocha":"^2.1.0","cssmin":"~0.4.3"},"directories":{"test":"test"},"bin":{"px2rem":"./bin/px2rem.js"},"scripts":{"test":"mocha","test-travis":"node node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter dot"},"main":"index.js","keywords":["3x","rem","px2rem"],"license":"MIT","gitHead":"d11fe8ddd67acc3a05d7d4ee1724f6d560951962","bugs":{"url":"https://github.com/songsiqi/px2rem/issues"},"_id":"px2rem@0.4.2","_shasum":"d4f9e63043af099fd5d6b5537c025dccc7fbe178","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"songsiqi","email":"songsiqi2006@126.com"},"maintainers":[{"name":"songsiqi","email":"songsiqi2006@126.com"}],"dist":{"shasum":"d4f9e63043af099fd5d6b5537c025dccc7fbe178","tarball":"http://registry-npm.ywwl.com/px2rem/download/px2rem-0.4.2.tgz","integrity":"sha512-wV1xWm9HY1ki2TkcCOwPGCkcVN9Ff9u2rx2ikq10REudpG1VM2StzHu9PQFi1FwGd8l1K32m1GhKa8il8WZKeg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2uaLn0ig893c5obkhLUwuobmYF0vIAsUzm9FqdEER8wIhAIuNxig6PaIKqC0QQQd1Cxoi7LEMEgLDa2M/qf807ZEc"}],"size":24986,"noattachment":false,"key":"/px2rem/-/px2rem-0.4.2.tgz"},"readme":"# px2rem\n\nAccording to one stylesheet, generate rem version and @1x, @2x and @3x stylesheet.\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[npm-image]: https://img.shields.io/npm/v/px2rem.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/px2rem\n[travis-image]: https://img.shields.io/travis/songsiqi/px2rem.svg?style=flat-square\n[travis-url]: https://travis-ci.org/songsiqi/px2rem\n[coveralls-image]: https://img.shields.io/coveralls/songsiqi/px2rem.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/songsiqi/px2rem\n[downloads-image]: http://img.shields.io/npm/dm/px2rem.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/px2rem\n\nThis set of tools contains:\n\n* a CLI tool\n* [gulp plugin](https://www.npmjs.com/package/gulp-px3rem)\n* [webpack loader](https://www.npmjs.com/package/px2rem-loader)\n* [postcss plugin](https://www.npmjs.com/package/postcss-px2rem)\n\n## Usage\n\nThe raw stylesheet only contains @2x style, and if you\n\n* don't intend to transform the original value, eg: 1px border, add `/*no*/` after the declaration\n* intend to use px by force，eg: font-size, add `/*px*/` after the declaration\n\n**Attention: Dealing with SASS or LESS, only `/*...*/` comment can be used, in order to have the comments persisted**\n\n### CLI tool\n\n```\n$ npm install -g px2rem\n```\n```\n$ px2rem -o build src/*.css\n```\n\n```\n  Usage: px2rem [options] <file...>\n\n  Options:\n\n    -h, --help                      output usage information\n    -V, --version                   output the version number\n    -u, --remUnit [value]           set `rem` unit value (default: 75)\n    -x, --threeVersion [value]      whether to generate @1x, @2x and @3x version stylesheet (default: false)\n    -r, --remVersion [value]        whether to generate rem version stylesheet (default: true)\n    -b, --baseDpr [value]           set base device pixel ratio (default: 2)\n    -p, --remPrecision [value]      set rem value precision (default: 6)\n    -o, --output [path]             the output file dirname\n```\n\n### API\n\n```\nvar Px2rem = require('px2rem');\nvar px2remIns = new Px2rem([config]);\nvar originCssText = '...';\nvar dpr = 2;\nvar newCssText = px2remIns.generateRem(originCssText); // generate rem version stylesheet\nvar newCssText = px2remIns.generateThree(originCssText, dpr); // generate @1x, @2x and @3x version stylesheet\n```\n\n### Example\n\n#### Pre processing:\n\nOne raw stylesheet: `test.css`\n\n```\n.selector {\n    width: 150px;\n    height: 64px; /*px*/\n    font-size: 28px; /*px*/\n    border: 1px solid #ddd; /*no*/\n}\n```\n\n#### After processing:\n\nRem version: `test.debug.css`\n\n```\n.selector {\n    width: 2rem;\n    border: 1px solid #ddd;\n}\n[data-dpr=\"1\"] .selector {\n    height: 32px;\n    font-size: 14px;\n}\n[data-dpr=\"2\"] .selector {\n    height: 64px;\n    font-size: 28px;\n}\n[data-dpr=\"3\"] .selector {\n    height: 96px;\n    font-size: 42px;\n}\n```\n\n@1x version: `test1x.debug.css`\n\n```\n.selector {\n    width: 75px;\n    height: 32px;\n    font-size: 14px;\n    border: 1px solid #ddd;\n}\n```\n\n@2x version: `test2x.debug.css`\n\n```\n.selector {\n    width: 150px;\n    height: 64px;\n    font-size: 28px;\n    border: 1px solid #ddd;\n}\n```\n\n@3x version: `test3x.debug.css`\n\n```\n.selector {\n    width: 225px;\n    height: 96px;\n    font-size: 42px;\n    border: 1px solid #ddd;\n}\n```\n\n## Technical proposal\n\ncomment hook + css parser\n\n## Change Log\n\n### 0.5.0\n\n* Support Animation keyframes (no `/*px*/` comment).\n\n### 0.4.2\n\n* The generated [data-dpr] rules follow the origin rule, no longer placed at the end of the whole style sheet.\n* Optimize 0px, do not generate 3 [data-dpr] rules.\n\n### 0.3.1\n\n* Change default remUnit to 75.\n* Delete comment config.\n* Don't generate @1x, @2x and @3x version stylesheet by default.\n\n### 0.2.2\n\n* Support media query.\n\n### 0.1.8\n\n* Fix cli option duplication bug.\n* Fix regular expression bug.\n* Fix common comments bug which affects rem transformation.\n\n## License\n\nMIT\n","publish_time":1447510259095,"_cnpm_publish_time":1447510259095,"dist-tags":{"0.1.0":"0.1.0","latest":"0.5.0"}}