@csstools/postcss-nested-calc (1.0.0)

Published 2026-02-24 13:49:05 +00:00 by atheaadmin

Installation

@csstools:registry=
npm install @csstools/postcss-nested-calc@1.0.0
"@csstools/postcss-nested-calc": "1.0.0"

About this package

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:

Node PostCSS CLI Webpack Create React App Gulp Grunt

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

Dependencies

Dependencies

ID Version
postcss-value-parser ^4.2.0

Peer Dependencies

ID Version
postcss ^8.2

Keywords

calc css math nested postcss-plugin
Details
npm
2026-02-24 13:49:05 +00:00
0
CC0-1.0
latest
5.2 KiB
Assets (1)
Versions (1) View all
1.0.0 2026-02-24