{"name":"icss-utils","version":"3.0.0","description":"ICSS utils for postcss ast","main":"lib/index.js","files":["lib"],"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":4}}]]},"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":"^6.0.2"},"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":"f40da139f86e8514a6a58230437f1da71f5f5084","_id":"icss-utils@3.0.0","_shasum":"6538fc5f3845567477dd7e898a403ea22d6af459","_from":".","_npmVersion":"4.5.0","_nodeVersion":"6.3.1","_npmUser":{"name":"trysound","email":"trysound@yandex.ru"},"dist":{"shasum":"6538fc5f3845567477dd7e898a403ea22d6af459","tarball":"http://registry-npm.ywwl.com/icss-utils/download/icss-utils-3.0.0.tgz","integrity":"sha512-KNMK/TALvg/qL82MGY3+ezvx7pacItX8i7DHB3GkVu5s48z72owCiFK9+3Ogh3FhWJCpYbK/WjD6dPi+DXt8Jg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB2NoqMIMB5HhMjbk7HtVlVoOIFJ1J1ma67fdjRxJNtcAiEAhQxenC1GHWcz2JAh8h9jLp13NeJeuo7jk7B+R3KdfU0="}],"size":2995,"noattachment":false,"key":"/icss-utils/-/icss-utils-3.0.0.tgz"},"maintainers":[{"name":"geelen","email":"hi@glenmaddern.com"},{"name":"trysound","email":"trysound@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/icss-utils-3.0.0.tgz_1497481139017_0.6673620764631778"},"directories":{},"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":1497481139931,"_cnpm_publish_time":1497481139931,"dist-tags":{"latest":"5.1.0","next":"5.0.0-rc.0"}}