{"name":"@csstools/postcss-progressive-custom-properties","version":"4.2.0","keywords":["css","custom","declarations","postcss","postcss-plugin","progressive","properties","utility","variables","vars"],"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"MIT-0","_id":"@csstools/postcss-progressive-custom-properties@4.2.0","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"homepage":"https://github.com/csstools/postcss-plugins#readme","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"dist":{"shasum":"7f15349c2cd108478d28e1503c660d4037925030","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-progressive-custom-properties/download/@csstools/postcss-progressive-custom-properties-4.2.0.tgz","fileCount":7,"integrity":"sha512-fWCXRasX17N1NCPTCuwC3FJDV+Wc031f16cFuuMEfIsYJ1q5ABCa59W0C6VeMGqjNv6ldf37vvwXXAeaZjD9PA==","signatures":[{"sig":"MEUCIDxkvp7B7njuwY+Xa5JSSu4ixzNdq0tkQVI9fai97i8mAiEAnNz3pI0MgmUh6cF79sWsUyBNwsEHgf7kVefnhIEbHI0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":62097,"size":7596,"noattachment":false,"key":"/@csstools/postcss-progressive-custom-properties/-/@csstools/postcss-progressive-custom-properties-4.2.0.tgz"},"main":"dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"default":"./dist/index.cjs"}}},"funding":[{"url":"https://github.com/sponsors/csstools","type":"github"},{"url":"https://opencollective.com/csstools","type":"opencollective"}],"gitHead":"e015c2a9506a5e901373d2d833a1eaa455d377b3","scripts":{},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"repository":{"url":"git+https://github.com/csstools/postcss-plugins.git","type":"git","directory":"plugins/postcss-progressive-custom-properties"},"_npmVersion":"11.4.2","description":"Correctly declare progressive enhancements for CSS Custom Properties.","directories":{},"_nodeVersion":"24.4.0","dependencies":{"postcss-value-parser":"^4.2.0"},"_hasShrinkwrap":false,"peerDependencies":{"postcss":"^8.4"},"_npmOperationalInternal":{"tmp":"tmp/postcss-progressive-custom-properties_4.2.0_1755891803945_0.6139365325798141","host":"s3://npm-registry-packages-npm-production"},"readme":"# PostCSS Progressive 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[![Build Status][cli-img]][cli-url]\n[<img alt=\"Discord\" src=\"https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white\">][discord]\n\n[PostCSS Progressive Custom Properties] is a utility plugin to correctly declare Custom Property fallbacks and enhancements.\n\n> [!WARNING]\n> It is not intended to be used directly by stylesheet authors.\n> Meant to be included in other PostCSS plugins that provide CSS value transforms as fallbacks.\n\n[Custom Properties are not discarded like regular declarations when invalid.](https://www.w3.org/TR/css-variables-1/#invalid-variables)\nThis makes it tricky to provide fallback values for older browsers.\n\nThe solution is to wrap Custom Property declarations in an `@supports` rule.\n\n```css\n:root {\n\t/* fallback */\n\t--a-color: red;\n\t/* progressive enhancement */\n\t--a-color: oklch(40% 0.234 0.39 / var(--opacity-50));\n}\n\n/* becomes */\n\n:root {\n\t--a-color: red;\n}\n\n@supports (color: oklch(0% 0 0)) {\n\t:root {\n\t\t--a-color: oklch(40% 0.234 0.39 / var(--opacity-50));\n\t}\n}\n```\n\n## Ignored values\n\n`initial` and `<white space>` are ignored.\n\n```css\n.initial {\n\t--prop-1: red;\n\t--prop-1: initial;\n}\n\n.white-space {\n\t--prop-1: red;\n\t--prop-1:;\n\n\t--prop-2: red;\n\t--prop-2: ;\n\n\t--prop-3: red;\n\t--prop-3:    ;\n}\n\n/* remains */\n\n.initial {\n\t--prop-1: red;\n\t--prop-1: initial;\n}\n\n.white-space {\n\t--prop-1: red;\n\t--prop-1:;\n\n\t--prop-2: red;\n\t--prop-2: ;\n\n\t--prop-3: red;\n\t--prop-3:    ;\n}\n```\n\n## Usage\n\nAdd [PostCSS Progressive Custom Properties] to your project:\n\n```bash\nnpm install @csstools/postcss-progressive-custom-properties --save-dev\n```\n\nUse [PostCSS Progressive Custom Properties] as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssCustomProperties = require('@csstools/postcss-progressive-custom-properties');\n\npostcss([\n  postcssProgressiveCustomProperties()\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n## @supports\n\nThis plugin wraps Custom Property override declarations in an `@supports` rule.\nWith PostCSS 8 this trigger declaration visitors to run again.\n\nMake sure your plugin detects and ignores values inside relevant `@supports` rules.\n\n## Reading list \n\n- https://moderncss.dev/how-custom-property-values-are-computed/\n\n[PostCSS Progressive 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) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- |\n\n\n[cli-img]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-img]: https://img.shields.io/npm/v/@csstools/postcss-progressive-custom-properties.svg\n[npm-url]: https://www.npmjs.com/package/@csstools/postcss-progressive-custom-properties\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Progressive Custom Properties]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties\n","publish_time":1755891804123,"_cnpm_publish_time":1755891804123,"dist-tags":{"latest":"5.1.5"}}