postcss-register-custom-props
PostCSS plugin that transforms custom property registration in CSS to JS.
According to the current "Custom Properties and Values API Level 1" specification you can register custom property with JavaScript, like:
CSS;
There is a proposal to the "Custom Properties and Values API Level 2" specification to make it possible to do the same in CSS:
@
This PostCSS plugin allows you to declare custom property in CSS and generate JavaScript file that contains registrations.
Input:
@
Output:
if "registerProperty" in CSS CSS;
Installation
-
npm:
npm install --save-dev postcss-register-custom-props
-
yarn:
yarn add -D postcss-register-custom-propsk
Usage
postcss
See [PostCSS] docs for examples of your environment.
Options
output
Specifies custom properties JavaScript file path and name. Defaults to ./custom-properties.js
.