"readme": "\n**Fork Info:** Implements [#169](https://github.com/postcss/postcss-custom-properties/issues/169) by adding a `preserveWithFallback` flag.\n\n# PostCSS Custom Properties [<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[![CSS Standard Status][css-img]][css-url]\n[![Build Status][cli-img]][cli-url]\n[![Support Chat][git-img]][git-url]\n\n[PostCSS Custom Properties] lets you use Custom Properties in CSS, following\nthe [CSS Custom Properties] specification.\n\n[](https://caniuse.com/#feat=css-variables)\n\n```pcss\n:root {\n --color: red;\n}\n\nh1 {\n color: var(--color);\n}\n\n/* becomes */\n\n:root {\n --color: red;\n}\n\nh1 {\n color: red;\n color: var(--color);\n}\n```\n\n## Usage\n\nAdd [PostCSS Custom Properties] to your project:\n\n```bash\nnpm install postcss-custom-properties --save-dev\n```\n\nUse [PostCSS Custom Properties] to process your CSS:\n\n```js\nconst postcssCustomProperties = require('postcss-custom-properties');\n\npostcssCustomProperties.process(YOUR_CSS /*, processOptions, pluginOptions */);\n```\n\nOr use it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssCustomProperties = require('postcss-custom-properties');\n\npostcss([\n postcssCustomProperties(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n[PostCSS Custom Properties] runs in all Node environments, with special instructions for:\n\n| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- | --- |\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether Custom Properties and properties using\ncustom properties should be preserved in their original form. By default, both\nof these are preserved.\n\n```js\npostcssCustomProperties({\n preserve: false\n});\n```\n\n```pcss\n:root {\n --color: red;\n}\n\nh1 {\n color: var(--color);\n}\n\n/* becomes */\n\nh1 {\n color: red;\n}\n```\n\n### importFrom\n\nThe `importFrom` option specifies sources where Custom Properties can be imported\nfrom, which might be CSS, JS, and JSON files, functions, and directly passed\nobjects.\n\n```js\npostcssCustomProperties({\n importFrom: 'path/to/file.css' // => :root { --color: red }\n});\n```\n\n```pcss\nh1 {\n color: var(--color);\n}\n\n/* becomes */\n\nh1 {\n color: red;\n}\n```\n\nMultiple sources can be passed into this option, and they will be parsed in the\norder they are received. JavaScript files, JSON files, functions, and objects\nwill need to namespace Custom Properties using the `customProperties` or\n`custom-properties` key.\n\n```js\npostcssCustomProperties({\n importFrom: [\n 'path/to/file.css', // :root { --color: red; }\n 'and/then/this.js', // module.exports = { customProperties: { '--color': 'red' } }\n 'and/then/that.json', // { \"custom-properties\": { \"--color\": \"red\" } }\n {\n customProperties: { '--color': 'red' }\n },\n () => {\n const customProperties = { '--color': 'red' };\n\n return { customProperties };\n }\n ]\n});\n```\n\nSee example imports written in [CSS](test/import-properties.css),\n[JS](test/import-properties.js), and [JSON](test/import-properties.json).\n\n### exportTo\n\nThe `exportTo` option specifies destinations where Custom Properties can be exported\nto, which might be CSS, JS, and JSON files, functions, and directly passed\nobjects.\n\n```js\npostcssCustomProperties({\n exportTo: 'path/to/file.css' // :root { --color: red; }\n});\n```\n\nMultiple destinations can be passed into this option, and they will be parsed\nin the order they are received. JavaScript files, JSON files, and objects will\nneed to namespace Custom Properties using the `customProperties` or\n`custom-properties` key.\n\n```js\nconst cachedObject = { customProperties: {} };\n\npostcssCustomProperties({\n exportTo: [\n 'path/to/file.css', // :root { --color: red; }\n 'and/then/this.js', // module.exports = { customProperties: { '--color': 'red' } }\n 'and/then/this.mjs', // export const customProperties = { '--color': 'red' } }\n 'and/then/that.json', // { \"custom-properties\": { \"--color\": \"red\" } }\n cachedObject,\n customProperties => {\n customProperties // { '--color': 'red' }\n }\n ]\n});\n```\n\nSee example exports written to [CSS](test/export-properties.css),\n[JS](test/export-properties.js), [MJS](test/export-properties.mjs), and\n[JSON](test/export-properties.json).\n\n[cli-img]: https://img.shields.io/travis/postcss/postcss-custom-properties/master.svg\n[cli-url]: https://travis-ci.org/postcss/postcss-custom-properties\n[css-img]: https://cssdb.org/badge/custom-properties.svg\n[css-url]: https://cssdb.org/#custom-properties\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-custom-properties.svg\n[npm-url]: https://www.npmjs.com/package/postcss-custom-properties\n\n[CSS Custom Properties]: https://www.w3.org/TR/css-variables-1/\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Custom Properties]: https://github.com/postcss/postcss-custom-properties\n",
0 commit comments