{"name":"icss-utils","version":"4.0.0","description":"ICSS utils for postcss ast","main":"lib/index.js","engines":{"node":">= 6"},"scripts":{"build":"babel --out-dir lib src","test":"jest --coverage","precommit":"lint-staged","prepublish":"yarn test && yarn run build"},"lint-staged":{"*.js":["prettier --write","eslint","git add"]},"eslintConfig":{"parserOptions":{"sourceType":"module"},"env":{"es6":true},"extends":"eslint:recommended"},"babel":{"presets":[["env",{"targets":{"node":6}}]]},"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","dependencies":{"postcss":"^7.0.5"},"devDependencies":{"babel-cli":"^6.24.1","babel-jest":"^20.0.3","babel-preset-env":"^1.5.2","eslint":"^4.0.0","husky":"^0.13.4","jest":"^20.0.4","lint-staged":"^3.6.1","prettier":"^1.4.4"},"gitHead":"2bfed2e97ee5409a6c0c0a36b298a078b11988e8","_id":"icss-utils@4.0.0","_npmVersion":"5.10.0","_nodeVersion":"10.8.0","_npmUser":{"name":"sullenor","email":"iamhoneyboy@gmail.com"},"dist":{"integrity":"sha512-bA/xGiwWM17qjllIs9X/y0EjsB7e0AV08F3OL8UPsoNkNRibIuu8f1eKTnQ8QO1DteKKTxTUAn+IEWUToIwGOA==","shasum":"d52cf4bcdcfa1c45c2dbefb4ffdf6b00ef608098","tarball":"http://registry-npm.ywwl.com/icss-utils/download/icss-utils-4.0.0.tgz","fileCount":8,"unpackedSize":8746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2tLTCRA9TVsSAnZWagAAIWwQAIuU2xQLRZxBlJz7cwky\n5W5LK3UAValx8uxy9us/RNwonOl3yPqDg1YLHceFB7nZrTdaQSvs1foXCfnW\nca/D0MwjWZfDWISrJxdFnH3NAnpCWsBrbxt1+Db8LWUH8fwkZv4zOaQQUIjA\neW7bZJK4lYFLTX8tU3DArezQqZ/DOMpeGDtprVNQoO76bZNcSAB2+VZr1sB6\ng3W83CnXM3YwneuEw986aoTOEGen43eQgkQfInj+cJEEMQARRJF5jkdN2Ndw\nN0cqRPyiC66g1SCgLQbwjBcN0dOdbg7qKrwzBqp00SqnYHYVICMXl6zOmi/G\nnr47D3JfDK15+nqvvo37PInlYlutlCot14B7Ik+B3mphqmZGLly2E9RiNmFb\nL59pAHWfPb08htVD4dX/g5oUOuOeDBwL/Q5STqrhKqtStSu6MF5Zm3fUJUYQ\niPMNR8peWvWIwqi8KbjyoBDI4oBzBqEGA2RlUqdcguarcv9v8vYwizE11KGI\nTjtEeOEW2tk0k5ybjU9HEJoCYpfLU+AjR4C2sdb8eovvbVVrYGVbmPWELfXW\ngZhrGF6CjMhbHMcnVCNF7g0+OEbmUgGUr/bpMMJAm6c8sYbJOQHkJ0JinBl7\nl4/pDwc1iXLzasjUsKliT2rlNfhNmn/4Y7QT3zHO5vRinshMWqK2Kx8Ma5Dz\nRWSQ\r\n=56df\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF29JxG8TQXEDB4/bjSsVCFlv0tr9HyEDFGtHqlqKkd/AiEAteZOfyQHpp0uJkHaQ1eXI21L/e3gZNKruXVHuh0E108="}],"size":3306,"noattachment":false,"key":"/icss-utils/-/icss-utils-4.0.0.tgz"},"maintainers":[{"name":"geelen","email":"hi@glenmaddern.com"},{"name":"trysound","email":"trysound@yandex.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/icss-utils_4.0.0_1541067474885_0.42543968656867515"},"_hasShrinkwrap":false,"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, mode = 'auto')\n\nExtracts and remove (if removeRules is equal true) from PostCSS tree `:import`, `@icss-import`, `:export` and `@icss-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\nBy default both the pseudo and at-rule form of the import and export statements\nwill be removed. Pass the `mode` option to limit to only one type.\n\n## createICSSRules(icssImports, icssExports, mode = 'rule')\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\nBy default it will create pseudo selector rules (`:import` and `:export`). Pass\n`at-rule` for `mode` to instead generate `@icss-import` and `@icss-export`, which\nmay be more resilient to post processing by other tools.\n\n## License\n\nISC\n\n---\n\nGlen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.\n","publish_time":1541067475040,"_cnpm_publish_time":1541067475040,"dist-tags":{"latest":"5.1.0","next":"5.0.0-rc.0"}}