2.0.3 • Published 3 months ago

@lesjoursfr/postcss-extract-css-variables v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

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' })
  ]
}
2.0.3

3 months ago

2.0.2

4 months ago

2.0.1

5 months ago

2.0.0

10 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago