{"name":"postcss-env-function","description":"Use env() variables in CSS","version":"8.0.0","author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"MIT-0","funding":[{"type":"github","url":"https://github.com/sponsors/csstools"},{"type":"opencollective","url":"https://opencollective.com/csstools"}],"engines":{"node":">=20.19.0"},"exports":{".":{"default":"./dist/index.mjs"}},"dependencies":{"postcss-value-parser":"^4.2.0"},"peerDependencies":{"postcss":"^8.4"},"scripts":{},"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-env-function#readme","repository":{"type":"git","url":"git+https://github.com/csstools/postcss-plugins.git","directory":"plugins/postcss-env-function"},"bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"keywords":["constants","css","environments","envs","functions","postcss","postcss-plugin","variables"],"gitHead":"aae0cba3468a1b1804c4fdde703046c1c10bd421","_id":"postcss-env-function@8.0.0","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-iORUgBuibJSeT0jYvJ2rdz05Nx9zLr7j0MVzwsBN/uIN1uYKASK/lXYwdbfrgoiqsXvawkA2aYzIJ8UiD1AlDA==","shasum":"c4991069905fc2751bb9de133a213a5aa8bf6fa4","tarball":"http://registry-npm.ywwl.com/postcss-env-function/download/postcss-env-function-8.0.0.tgz","fileCount":5,"unpackedSize":10176,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDnT4dZg5dxjVhTgBEgsdboMxS8VFxSCD4wyskazKpOKAIhAKqrnMBEsLAbzUIq6mkAABo1US25HWT5CkLOXf3Mc1lM"}],"size":4058,"noattachment":false,"key":"/postcss-env-function/-/postcss-env-function-8.0.0.tgz"},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-env-function_8.0.0_1768375333853_0.04285257523956143"},"_hasShrinkwrap":false,"readme":"# PostCSS Environment Variables [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][postcss]\n\n[<img alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/postcss-env-function.svg\" height=\"20\">][npm-url]\n[<img alt=\"Build Status\" src=\"https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg\" height=\"20\">][cli-url]\n[<img alt=\"Discord\" src=\"https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white\">][discord]\n<br><br>\n[<img alt=\"Baseline Status\" src=\"https://cssdb.org/images/badges-baseline/environment-variables.svg\" height=\"20\">][css-url]\n[<img alt=\"CSS Standard Status\" src=\"https://cssdb.org/images/badges/environment-variables.svg\" height=\"20\">][css-url]\n\n[PostCSS Environment Variables] lets you use `env()` variables in CSS, following the [CSS Environment Variables] specification.\n\n⚠️ Custom Environment Variables were never defined in a specification and we are no longer including this in `postcss-preset-env`.<br>\nIn the future there might be renewed interest in Custom Environment Variables.\n\nWe advice users of this plugin to seek alternatives such as [postcss-design-tokens](https://github.com/csstools/postcss-plugins/tree/postcss-preset-env--v8/plugins/postcss-design-tokens#readme)\n\n```css\n@media (max-width: env(--branding-small)) {\n  body {\n    padding: env(--branding-padding);\n  }\n}\n\n/* becomes */\n\n@media (min-width: 600px) {\n  body {\n    padding: 20px;\n  }\n}\n\n/* when the `importFrom` option is: {\n  \"environmentVariables\": {\n    \"--branding-small\": \"600px\",\n    \"--branding-padding\": \"20px\"\n  }\n} */\n```\n\n## Usage\n\nAdd [PostCSS Environment Variables] to your project:\n\n```bash\nnpm install postcss postcss-env-function --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss')\nconst postcssEnvFunction = require('postcss-env-function')\n\npostcss([\n  postcssEnvFunction(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */)\n```\n\n[PostCSS Environment Variables] 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) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- |\n\n## Options\n\n### importFrom\n\nThe `importFrom` option specifies sources where Environment Variables can be imported from, which might be JS and JSON files, functions, and directly passed objects.\n\n```js\npostcssEnvFunction({\n  importFrom: 'path/to/file.js' /* module.exports = {\n      environmentVariables: {\n        '--branding-padding': '20px',\n        '--branding-small': '600px'\n      }\n    } */\n})\n```\n\n```css\n@media (max-width: env(--branding-small)) {\n  body {\n    padding: env(--branding-padding);\n  }\n}\n\n/* becomes */\n\n@media (min-width: 600px) {\n  body {\n    padding: 20px;\n  }\n}\n```\n\nMultiple sources can be passed into this option, and they will be parsed in the order they are received. JavaScript files, JSON files, functions, and objects will need to namespace Custom Properties using the `environmentVariables` or `environment-variables` key.\n\n```js\npostcssEnvFunction({\n  importFrom: [\n    /* Import from a CommonJS file:\n    \n    module.exports = {\n      environmentVariables: {\n        '--branding-padding': '20px'\n      }\n    } */\n    'path/to/file.js',\n\n    /* Import from a JSON file:\n\n    {\n      \"environment-variables\": {\n        \"--branding-padding\": \"20px\"\n      }\n    } */\n    'and/then/this.json',\n\n    /* Import from an JavaScript Object: */\n    {\n      environmentVariables: { '--branding-padding': '20px' }\n    },\n\n    /* Import from a JavaScript Function: */\n    () => {\n      const environmentVariables = { '--branding-padding': '20px' }\n\n      return { environmentVariables }\n    }\n  ]\n})\n```\n\nSee example imports written in [JS](test/import-variables.js) and [JSON](test/import-variables.json).\nCurrently only valid [custom property names] (beginning with `--`) are accepted.\nNot all valid [declaration value names] are accepted.\n\n### disableDeprecationNotice\n\nSilence the deprecation notice that is printed to the console when using `importFrom``.\n\n> postcss-env-function is deprecated and will be removed.\n> Check the discussion on github for more details. https://github.com/csstools/postcss-plugins/discussions/192\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#environment-variables\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/postcss-env-function\n\n[CSS Environment Variables]: https://drafts.csswg.org/css-env-1/\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Environment Variables]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-env-function\n\n[custom property names]: https://drafts.csswg.org/css-variables-1/#typedef-custom-property-name\n[declaration value names]: https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value\n","publish_time":1768375334001,"_cnpm_publish_time":1768375334001,"dist-tags":{"latest":"8.0.0"}}