Skip to content

postcss-extract-css-variables 2.0.5

Install from the command line:
Learn more about npm packages
$ npm install @lesjoursfr/postcss-extract-css-variables@2.0.5
Install via package.json:
"@lesjoursfr/postcss-extract-css-variables": "2.0.5"

About this version

npm version QC Checks

postcss-extract-css-variables

PostCSS plugin to extract rules with CSS variables.

/* Input example */
.lj-color-35 {
	--lj-color-main: #fda92a;
	--lj-color-alpha: rgba(253, 169, 42, 0.75);
	--lj-color-light: #fdde2a;
	--lj-color-mixed: #fdc42a;
}

.selector-1 {
	background-color: var(--lj-color-main);
	content: "";
	display: inline-block;
	height: 5px;
	margin-right: 10px;
	width: 18px;
}
/* Output example */
.lj-color-35 .selector-1 {
	background-color: #fda92a;
}

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-extract-css-variables

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin add the end of the plugins list:

module.exports = {
  plugins: [
    require('autoprefixer'),
+   require('postcss-extract-css-variables')({ output: './output.css' })
  ]
}

Details


Assets

  • postcss-extract-css-variables-2.0.5.tgz

Download activity

  • Total downloads 42
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all