Skip to content

Files

Latest commit

 

History

History

postcss-base-plugin

PostCSS Base Plugin PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

npm install @csstools/postcss-base-plugin --save-dev

PostCSS Base Plugin lets you easily create new plugins following some CSS Specification.

.foo {
	color: red;
}

.baz {
	color: green;
}

/* becomes */

.foo {
	color: blue;
}

.baz {
	color: green;
}

Usage

Add PostCSS Base Plugin to your project:

npm install postcss @csstools/postcss-base-plugin --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssBasePlugin = require('@csstools/postcss-base-plugin');

postcss([
	postcssBasePlugin(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS Base Plugin runs in all Node environments, with special instructions for:

Options

preserve

The preserve option determines whether the original notation is preserved. By default, it is not preserved.

postcssBasePlugin({ preserve: true })
.foo {
	color: red;
}

.baz {
	color: green;
}

/* becomes */

.foo {
	color: blue;
	color: red;
}

.baz {
	color: green;
}