postcss-arithmetic
PostCSS plugin to do +, -, *, /, %, and ^ operations.
Utilizes math.js to correctly parse order of operations. Also,
when expressions can not be resolved (if there are are multiple
units types for example), postcss-arithmetic can replace the whole
expression with a CSS calc()
statement.
Syntax
Use the operators just like in JavaScript. The following example has the
calcMultipleUnits
option enabled. Use parentheses around side-by-side
expressions to make sure everything inside is evaluated together. See the
code example for how to do this.
/* Before running postcss-arithmetic */ /* After running postcss-arithmetic */
Options:
calcMultipleUnits
--- Replace exrpessions with multiple units with CSScalc()
functions; type:Boolean
, Default:true