@csstools/postcss-nested-calc
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

PostCSS Nested Calc PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

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

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.2
    370,790
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.2
    370,790
  • 3.0.1
    99,435
  • 3.0.0
    223,827
  • 2.0.2
    243,592
  • 2.0.1
    4,693
  • 2.0.0
    2,514
  • 1.0.0
    2,533,351

Package Sidebar

Install

npm i @csstools/postcss-nested-calc

Weekly Downloads

3,478,202

Version

3.0.2

License

MIT-0

Unpacked Size

7.21 kB

Total Files

7

Last publish

Collaborators

  • romainmenke
  • alaguna
  • jonathantneal