epiphany/node_modules/@csstools/postcss-nested-calc
2023-12-09 22:48:07 -08:00
..
dist stylelint/eleventy config 2023-12-09 22:48:07 -08:00
CHANGELOG.md stylelint/eleventy config 2023-12-09 22:48:07 -08:00
LICENSE.md stylelint/eleventy config 2023-12-09 22:48:07 -08:00
package.json stylelint/eleventy config 2023-12-09 22:48:07 -08:00
README.md stylelint/eleventy config 2023-12-09 22:48:07 -08:00

PostCSS Nested Calc PostCSS Logo

npm version CSS Standard Status Build Status Discord

PostCSS Nested Calc lets you use nested calc() expressions following the CSS Values and Units 4 specification.

.example {
	order: calc(1 + calc(2 * 2));
}

/* becomes */

.example {
	order: calc(1 + (2 * 2));
	order: calc(1 + calc(2 * 2));
}

Usage

Add PostCSS Nested Calc to your project:

npm install postcss @csstools/postcss-nested-calc --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssNestedCalc = require('@csstools/postcss-nested-calc');

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

PostCSS Nested Calc runs in all Node environments, with special instructions for:

Options

preserve

The preserve option determines whether the original notation is preserved. By default the original values are preserved.

postcssNestedCalc({ preserve: false })
.example {
	order: calc(1 + calc(2 * 2));
}

/* becomes */

.example {
	order: calc(1 + (2 * 2));
}