{"name":"icss-utils","version":"5.0.0-rc.0","description":"ICSS utils for postcss ast","main":"src/index.js","engines":{"node":">= 10.13.0 || >= 12.13.0 || >= 14"},"scripts":{"prettier":"prettier -l --ignore-path .gitignore . \"!test/test-cases\"","eslint":"eslint --ignore-path .gitignore .","lint":"yarn eslint && yarn prettier","pretest":"yarn lint","test":"jest --coverage","test:only":"jest","autotest":"jest --coverage --watch","cover":"jest --coverage","ci":"yarn pretest && yarn cover","prepublishOnly":"yarn test"},"repository":{"type":"git","url":"git+https://github.com/css-modules/icss-utils.git"},"keywords":["css","modules","icss","postcss"],"author":{"name":"Glen Maddern"},"license":"ISC","bugs":{"url":"https://github.com/css-modules/icss-utils/issues"},"homepage":"https://github.com/css-modules/icss-utils#readme","devDependencies":{"eslint":"^7.9.0","husky":"^4.3.0","jest":"^26.4.2","lint-staged":"^10.4.0","postcss":"^8.0.6","prettier":"^2.1.2"},"peerDependencies":{"postcss":"^8.0.0"},"readme":"[![Build Status](https://travis-ci.org/css-modules/icss-utils.svg)](https://travis-ci.org/css-modules/icss-utils)\n\n# ICSS Utils\n\n## replaceSymbols\n\nGoverns the way tokens are searched & replaced during the linking stage of ICSS loading.\n\nThis is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins\n(i.e. [CSS Modules Values](https://github.com/css-modules/postcss-modules-values))\n\n```js\nimport { replaceSymbols, replaceValueSymbols } from \"icss-utils\";\n\nreplaceSymbols(css, replacements);\nreplaceValueSymbols(string, replacements);\n```\n\nWhere:\n\n- `css` is the PostCSS tree you're working with\n- `replacements` is an JS object of `symbol: \"replacement\"` pairs, where all occurrences of `symbol` are replaced with `replacement`.\n\nA symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:\n\n- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`\n- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`\n\n## extractICSS(css, removeRules = true)\n\nExtracts and remove (if removeRules is equal true) from PostCSS tree `:import` and `:export` statements.\n\n```js\nimport postcss from \"postcss\";\nimport { extractICSS } from \"icss-utils\";\n\nconst css = postcss.parse(`\n  :import(colors) {\n    a: b;\n  }\n  :export {\n    c: d;\n  }\n`);\n\nextractICSS(css);\n/*\n  {\n    icssImports: {\n      colors: {\n        a: 'b'\n      }\n    },\n    icssExports: {\n      c: 'd'\n    }\n  }\n*/\n```\n\n## createICSSRules(icssImports, icssExports)\n\nConverts icss imports and exports definitions to postcss ast\n\n```js\ncreateICSSRules(\n  {\n    colors: {\n      a: \"b\",\n    },\n  },\n  {\n    c: \"d\",\n  },\n  // Need pass `rule` and `decl` from postcss\n  // Please look at `Step 4` https://evilmartians.com/chronicles/postcss-8-plugin-migration\n  postcss\n);\n```\n\n## License\n\nISC\n\n---\n\nGlen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.\n","readmeFilename":"README.md","gitHead":"b39a59647569efd7bfb4c66d3098cadb887da33b","_id":"icss-utils@5.0.0-rc.0","_nodeVersion":"10.15.2","_npmVersion":"6.14.8","dist":{"integrity":"sha512-iTcLOd8eGcKQBusS3SRQYCK324r6Aov3GlfWRbRYC9oAp93v1qm7kBWB0WeEjZ3rGoOvymTkQUhOiTokNz9mKg==","shasum":"c72082bd0edaa2cd85b25bfe98db2e49be8d4306","tarball":"http://registry-npm.ywwl.com/icss-utils/download/icss-utils-5.0.0-rc.0.tgz","fileCount":9,"unpackedSize":8227,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfacs2CRA9TVsSAnZWagAA868P/1iBNrfzU4joXWmNYh9M\n174j2hx/yMpctlyc0Vp78nlInxMGw7J1Y3LkjT7YiOWKcWW2dPIj+mwtS4s+\nuTITS+1SxjMpxxHO72ROw10NAEzn09/1X2sGOYb6dXZxnTE7q/WDcTnraJ4A\nO91Wjm79N9dVf7XG9FzHuE+BZxzKRNlzG/J4aVQMuZyQ4OwBfF3MKF8fKsK8\nzlZMmriD+UER6DQDQb0nrlWL8+S01AqBu1An1L/b1rz0iGG1CHLtB6J4cCeX\n9vYho4QtN647k5XETizgTNinj0c4wWoSL6DMIbmkpwVyEVryFjlfiBgmM+xx\ng4H7mQLqzewKvKOni7gJ4v0AaT6OjiDl7RgvkmUcpsRz00NIQ8cS+NLOw/8I\nsANT1qbD7gA44gYO1yJ85QmwvuHsqfM+JURsy4JNCh1JD3fAcDHlE9f1NajP\n40hVU5KIg2DID3APFecDuq5oeHN5ovSiqzLvq5l0ehN4E5cc1fDN//K4CWix\nlH3JByVaKZBqg3gmloWSdpZfE6/rmDy37HRfwxaKaCZsLIAyKppmwwSSiN/i\nCG2mbUE8x5XoGroncYW7xE6yhFQQQbBVLzRLv77DTz83ZKZaNJICtfljdnAG\nDZkW1/O14tQHTtZjrSF1n1cmUn2OGAXDUU8B2ONf+vZUJFZz135hMP2X1FVL\n/MFB\r\n=7oU6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDxHT84pKv59aaWa5AgijP2Be+WmKNfWhO+rz5FzgGqAIgbOGP8oZLtacO+ndINIws8kMMjHvrxcOo7LDw1y+1RZA="}],"size":3513,"noattachment":false,"key":"/icss-utils/-/icss-utils-5.0.0-rc.0.tgz"},"maintainers":[{"name":"trysound","email":"trysound@yandex.ru"},{"name":"sullenor","email":"iamhoneyboy@gmail.com"},{"name":"geelen","email":"glen@glenmaddern.com"},{"name":"evilebottnawi","email":"sheo13666q@gmail.com"}],"_npmUser":{"name":"evilebottnawi","email":"sheo13666q@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/icss-utils_5.0.0-rc.0_1600768821398_0.6837232211656088"},"_hasShrinkwrap":false,"publish_time":1600768821592,"_cnpm_publish_time":1600768821592,"dist-tags":{"latest":"5.1.0","next":"5.0.0-rc.0"}}