Skip to content

Latest commit

 

History

History
 
 

README.md

PostCSS Base Plugin PostCSS Logo

npm version CSS Standard Status Build Status Discord

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;
}