{"_id":"@vusion/postcss-calc","_rev":"11-faf99405246194dd06fb8ef25321d82d","name":"@vusion/postcss-calc","dist-tags":{"latest":"7.0.3"},"versions":{"7.0.2":{"name":"@vusion/postcss-calc","version":"7.0.2","keywords":["css","postcss","postcss-plugin","calculation","calc"],"author":{"name":"Andy Jansson"},"license":"MIT","_id":"@vusion/postcss-calc@7.0.2","maintainers":[{"name":"cxhtml","email":"lanhai723@126.com"},{"name":"shaoyuee","email":"13588317944@163.com"},{"name":"rainfore","email":"rainforest92@126.com"},{"name":"moujintao","email":"moujintaotest@163.com"},{"name":"zhangsanshi","email":"zhangsanshi5566@gmail.com"}],"homepage":"https://github.com/postcss/postcss-calc#readme","bugs":{"url":"https://github.com/postcss/postcss-calc/issues"},"ava":{"require":["@babel/register","@babel/polyfill"]},"dist":{"shasum":"0bfae1452b3e944a751e61a94d63d69a40b79103","tarball":"https://registry.npmjs.org/@vusion/postcss-calc/-/postcss-calc-7.0.2.tgz","fileCount":10,"integrity":"sha512-HNUg1uf/kWCJBRNAG9TTdol/Bco5kOs0NR8rATS7petuf1cx7Mcf+SNqLfzJA07eUxDAa6f2nF1pGJP/NI64CQ==","signatures":[{"sig":"MEUCIQClLQh8fY9hmyxTu2T1Fw1J8Ay37mHJ22j9Bxl+i8iW9wIgba2dY4vmAhRYDIaH18faZgWnX6fYwTzqKKXinHbxy7w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":150511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeExt8CRA9TVsSAnZWagAARvQQAKQTt6VAt93TgVyqx3Iu\n36OSlncl1SOTLObIr4jX2Ydo/ambT6MDQQhSFL3S2FFiVFO4JXoR0zZDGqsl\ngnPHs4mBh3zhF3ES5H87sbZbji8T4zEixJgK0noRMTErw2CDxIe21m1Ww6Nx\n6H+XfFN0/vurg7RQN0yK1CIAASOI37m7483H8AY+O99BmlyqKMlu+dH9H2mX\nurNMbKINbESbfQADMClAghB/jk11gZKmpWoB03KSwUqQsUPUmEjFK7+j73gj\n1+8biKMYHuRGlb+1+QvrwkAWycugpeVVH86kYDZAF1DiEdkGZVEnS7kj7wNP\nVzUACyfOr8i/HzXV0sw+yoGm83P8kM1YJd9Oyhbf+mehoVvYs5Cg72AMjPbY\nYrXCg/6G8cM/nioTnkX8o56AeJP/Kc+vuQ/PdZ7DEaXGv6J17Bhq8SvqYKuX\nwsv+HS92blfvix6HcIzv2IQFUxPu3FD7VWWdiQ8m3rYuzfHaTy6spJlGWtL8\nqVIfbfipvwLkuy4W3CHk3MEBr/NKah13n3B9Cmhtftec/tXvoafVP1ehEODt\nqpqOOcR+9e2DsP2CpAJhB8XOAdVG2KwJVnadK/VAdUTJS/CmthEFFXAfKig6\nKqHjEjwaIXxGOWL9Ed0DSXYVrwH0WcymxsxoPtQWwwBkN/5yXAxt2NBOTIvm\n0FM4\r\n=BpMI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","gitHead":"6260789750bbf73006190ef00ab43abfb278b4dc","scripts":{"test":"ava","build":"del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore src/__tests__/**/*.js && jison src/parser.jison -o dist/parser.js","pretest":"npm run build && eslint src","prepublish":"npm run build"},"_npmUser":{"name":"rainfore","email":"rainforest92@126.com"},"repository":{"url":"git+https://github.com/postcss/postcss-calc.git","type":"git"},"_npmVersion":"6.13.2","description":"PostCSS plugin to reduce calc()","directories":{},"_nodeVersion":"10.16.3","dependencies":{"postcss":"^7.0.5","postcss-value-parser":"^3.3.1","postcss-selector-parser":"^6.0.2"},"eslintConfig":{"rules":{"curly":"error"},"parser":"babel-eslint","extends":"eslint-config-i-am-meticulous"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^1.0.0-beta.8","eslint":"^5.7.0","del-cli":"^1.1.0","cross-env":"^5.2.0","jison-gho":"^0.6.1-215","@babel/cli":"^7.1.2","@babel/core":"^7.1.2","babel-eslint":"^10.0.1","@babel/polyfill":"^7.0.0","@babel/register":"^7.0.0","@babel/preset-env":"^7.1.0","eslint-plugin-babel":"^5.2.1","eslint-plugin-import":"^2.14.0","eslint-config-i-am-meticulous":"^11.0.0","babel-plugin-add-module-exports":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-calc_7.0.2_1578310524481_0.7117635697331604","host":"s3://npm-registry-packages"}},"7.0.3":{"name":"@vusion/postcss-calc","version":"7.0.3","keywords":["css","postcss","postcss-plugin","calculation","calc"],"author":{"name":"Andy Jansson"},"license":"MIT","_id":"@vusion/postcss-calc@7.0.3","maintainers":[{"name":"cxhtml","email":"lanhai723@126.com"},{"name":"moujintao","email":"moujintaotest@163.com"},{"name":"rainfore","email":"rainforest92@126.com"},{"name":"shaoyuee","email":"13588317944@163.com"},{"name":"zhangsanshi","email":"zhangsanshi5566@gmail.com"}],"homepage":"https://github.com/postcss/postcss-calc#readme","bugs":{"url":"https://github.com/postcss/postcss-calc/issues"},"ava":{"require":["@babel/register","@babel/polyfill"]},"dist":{"shasum":"500ca726fd3f1a8456123bc92481d2d5a737eaf7","tarball":"https://registry.npmjs.org/@vusion/postcss-calc/-/postcss-calc-7.0.3.tgz","fileCount":10,"integrity":"sha512-icDNrI0NW+5jAEwnOkIjrs6uS9o+cNVVXsThbmgdORqPkKl9Cgy3amGxDlk8QvmiDy+qisvPsDhRehDdY/iW9Q==","signatures":[{"sig":"MEUCIAfo8Cd2Mar4wHyxT4spZqPeqxN/QBF5wj8hz8POC3G0AiEAqOk0/lBa8S+bWKmviogDWgfAoMXQkYWX7mOkwyZH1aU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":150556,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXdkKCRA9TVsSAnZWagAAX1QQAJH1SGxHuAnhub5qhR/+\nbPhDICAuv19vULHTFk1wdjpJStiEhBDH44erRS94+9gety9nscM1l6CvpZ5w\nsTxJ3zZtBsNO081cPzmC7a3sIkmuuoc0znaA+jbjG/Kd+eGpW2kohOU6KZjO\nLjNpVDgY4zmJjBp3sRnwU5dRsobq6CVu2ktnPFUlQdXi1hJkPsj84vAc3eNM\nHc+oKFWlYwiLtzpnvkJuHrSWChDVGeXzQU/q1KeeUdQECTgUcy/hH8VqtC/q\nYUy/bUo/+fyj1+7PlYzidFgnPjVlt0RgRv8w6Yk9GCJ70173hx75vYj32vRL\nqIiiYoxCnNl08YQ5qc0xCN8GTrX6PYuRCJq4RQDmT8A55y/Zy3wL4Lu6FU9/\npj24Oi3vYG+ZkJIR8cz4PvmykFP251f5G8kZxS4W+hgtMqr7yaeMvz4ZabEU\nnWWetysRA/qF8JPVbphjvPsfWyAlX3lltFlsIw1PlEW/HDFWaNK1HXdY4RAB\nJfEEWtm1+jxQydy7eSDhHvm0xfv4yAdEHBlXa7d7OXvMD35re0NtoOYLqasw\nSPZDEEt2/OAC4fY2Bf6sb9IN1XzWrz7966MCvDSyurrFHE+nWS3fj+vHMNLS\nyPUqSf752Jc0+JmhNfhWK1DFryCd6lRIZMsbByN6vSYuKej1IHIOEIAMHToy\nKOy0\r\n=iKI7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","gitHead":"d1a03491e9906efcff545d1b64f55236a3c79a4c","scripts":{"test":"ava","build":"del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore src/__tests__/**/*.js && jison src/parser.jison -o dist/parser.js","pretest":"npm run build && eslint src","prepublish":"npm run build"},"_npmUser":{"name":"rainfore","email":"rainforest92@126.com"},"repository":{"url":"git+https://github.com/postcss/postcss-calc.git","type":"git"},"_npmVersion":"6.13.2","description":"PostCSS plugin to reduce calc()","directories":{},"_nodeVersion":"10.16.3","dependencies":{"postcss":"^7.0.5","postcss-value-parser":"^3.3.1","postcss-selector-parser":"^6.0.2"},"eslintConfig":{"rules":{"curly":"error"},"parser":"babel-eslint","extends":"eslint-config-i-am-meticulous"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^1.0.0-beta.8","eslint":"^5.7.0","del-cli":"^1.1.0","cross-env":"^5.2.0","jison-gho":"^0.6.1-215","@babel/cli":"^7.1.2","@babel/core":"^7.1.2","babel-eslint":"^10.0.1","@babel/polyfill":"^7.0.0","@babel/register":"^7.0.0","@babel/preset-env":"^7.1.0","eslint-plugin-babel":"^5.2.1","eslint-plugin-import":"^2.14.0","eslint-config-i-am-meticulous":"^11.0.0","babel-plugin-add-module-exports":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-calc_7.0.3_1583208713912_0.2366412523095982","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-01-06T11:35:24.269Z","modified":"2025-04-15T02:57:07.690Z","7.0.2":"2020-01-06T11:35:24.575Z","7.0.3":"2020-03-03T04:11:54.034Z"},"bugs":{"url":"https://github.com/postcss/postcss-calc/issues"},"author":{"name":"Andy Jansson"},"license":"MIT","homepage":"https://github.com/postcss/postcss-calc#readme","keywords":["css","postcss","postcss-plugin","calculation","calc"],"repository":{"url":"git+https://github.com/postcss/postcss-calc.git","type":"git"},"description":"PostCSS plugin to reduce calc()","maintainers":[{"email":"rainforest92@126.com","name":"rainfore"},{"email":"wddpwzz36@gmail.com","name":"lip966"},{"email":"13588254504@163.com","name":"linghaha"}],"readme":"# PostCSS Calc [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n[![NPM Version][npm-img]][npm-url]\n[![Build Status][cli-img]][cli-url]\n[![Support Chat][git-img]][git-url]\n\n[PostCSS Calc] lets you reduce `calc()` references whenever it's possible. This\ncan be particularly useful with the [PostCSS Custom Properties] plugin.\n\nWhen multiple units are mixed together in the same expression, the `calc()`\nstatement is left as is, to fallback to the [W3C calc() implementation].\n\n## Installation\n\n```bash\nnpm install postcss-calc\n```\n\n## Usage\n\n```js\n// dependencies\nvar fs = require(\"fs\")\nvar postcss = require(\"postcss\")\nvar calc = require(\"postcss-calc\")\n\n// css to be processed\nvar css = fs.readFileSync(\"input.css\", \"utf8\")\n\n// process css\nvar output = postcss()\n  .use(calc())\n  .process(css)\n  .css\n```\n\n**Example** (with [PostCSS Custom Properties] enabled as well):\n\n```js\n// dependencies\nvar fs = require(\"fs\")\nvar postcss = require(\"postcss\")\nvar customProperties = require(\"postcss-custom-properties\")\nvar calc = require(\"postcss-calc\")\n\n// css to be processed\nvar css = fs.readFileSync(\"input.css\", \"utf8\")\n\n// process css\nvar output = postcss()\n  .use(customProperties())\n  .use(calc())\n  .process(css)\n  .css\n```\n\nUsing this `input.css`:\n\n```css\n:root {\n  --main-font-size: 16px;\n}\n\nbody {\n  font-size: var(--main-font-size);\n}\n\nh1 {\n  font-size: calc(var(--main-font-size) * 2);\n  height: calc(100px - 2em);\n  margin-bottom: calc(\n      var(--main-font-size)\n      * 1.5\n    )\n}\n```\n\nyou will get:\n\n```css\nbody {\n  font-size: 16px\n}\n\nh1 {\n  font-size: 32px;\n  height: calc(100px - 2em);\n  margin-bottom: 24px\n}\n```\n\nCheckout [tests] for more examples.\n\n### Options\n\n#### `precision` (default: `5`)\n\nAllow you to define the precision for decimal numbers.\n\n```js\nvar out = postcss()\n  .use(calc({precision: 10}))\n  .process(css)\n  .css\n```\n\n#### `preserve` (default: `false`)\n\nAllow you to preserve calc() usage in output so browsers will handle decimal\nprecision themselves.\n\n```js\nvar out = postcss()\n  .use(calc({preserve: true}))\n  .process(css)\n  .css\n```\n\n#### `warnWhenCannotResolve` (default: `false`)\n\nAdds warnings when calc() are not reduced to a single value.\n\n```js\nvar out = postcss()\n  .use(calc({warnWhenCannotResolve: true}))\n  .process(css)\n  .css\n```\n\n#### `mediaQueries` (default: `false`)\n\nAllows calc() usage as part of media query declarations.\n\n```js\nvar out = postcss()\n  .use(calc({mediaQueries: true}))\n  .process(css)\n  .css\n```\n\n#### `selectors` (default: `false`)\n\nAllows calc() usage as part of selectors.\n\n```js\nvar out = postcss()\n  .use(calc({selectors: true}))\n  .process(css)\n  .css\n```\n\nExample:\n\n```css\ndiv[data-size=\"calc(3*3)\"] {\n  width: 100px;\n}\n```\n\n---\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style & run tests\nbefore submitting a bug fix or a feature.\n\n```bash\ngit clone git@github.com:postcss/postcss-calc.git\ngit checkout -b patch-1\nnpm install\nnpm test\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n\n[cli-img]: https://img.shields.io/travis/postcss/postcss-calc/master.svg\n[cli-url]: https://travis-ci.org/postcss/postcss-calc\n[git-img]: https://img.shields.io/badge/support-chat-blue.svg\n[git-url]: https://gitter.im/postcss/postcss\n[npm-img]: https://img.shields.io/npm/v/postcss-calc.svg\n[npm-url]: https://www.npmjs.com/package/postcss-calc\n\n[PostCSS]: https://github.com/postcss\n[PostCSS Calc]: https://github.com/postcss/postcss-calc\n[PostCSS Custom Properties]: https://github.com/postcss/postcss-custom-properties\n[tests]: src/__tests__/index.js\n[W3C calc() implementation]: https://www.w3.org/TR/css3-values/#calc-notation\n","readmeFilename":"README.md"}