- Fix Parse error on custom property fallback (#68) - @snowystinger)
- Switch to a maintained jison fork (#57) - @davidgovea)
- Fixed: Incorrect calculation when subtracting (e.g.
calc(100% - calc(120px + 1em + 2em + 100px))
) (#52 - @sylvainpolletvillard)
- Prevent webpack parsing issue (see zaach/jison#352)
- Fixed: Incorrect reduction for a specific case (e.g.
calc(1em + (1em - 5px))
) (#43 - @Justineo)
- Fixed: Incorrect reduction of division with custom property (e.g.
calc(var(--foo) / 2)
) (#41 - @Semigradsky)
- Fixed: Incorrect reduction of nested expression (e.g.
calc( (1em - calc( 10px + 1em)) / 2)
) (#39 - @gyoshev)
- Added: Support for working in browsers without transpiling (#36 - @Semigradsky)
- Fixed:
calc(100vw - (100vw - 100%))
does not evaluate to100%
(#35 - @Semigradsky)
- Fixed: Support division with a CSS variable.
- Fixed: CSS variable regex was overly greedy and caused a crash in some cases. (#27 - @andyjansson)
- Fixed: Regression in handling decimals without having any numbers after
the decimal place (e.g.
10.px
).
- Fixed: Regression in consecutive subtraction handling (#25 - @andyjansson)
- Fixed: Support for nested calc e.g.
calc(100% - calc(50px - 25px))
. - Fixed: Support for CSS variables e.g.
calc(var(--mouseX) * 1px)
.
- Rewritten with a jison parser for more accurate value parsing.
- Breaking: reduce-css-calc will now throw when trying to multiply or divide
by the same unit (e.g.
calc(200px * 20px)
), and also when trying to divide by zero. - Added: Better handling of zero values (e.g.
calc(100vw / 2 - 6px + 0px)
becomescalc(100vw / 2 - 6px)
). - Added: Better handling of mixed time values (e.g.
calc(1s - 50ms)
becomes0.95s
). - Added: Inner parentheses calculation to simplify complex expressions (e.g.
calc(14px + 6 * ((100vw - 320px) / 448))
becomescalc(9.71px + 1.34vw)
with precision set to2
). - Fixed:
calc(1px + 1)
does not evaluate to2px
.
(#22 - @andyjansson)
- Added: calc identifier from unresolved nested expressions are removed for better browser support (#19 - @ben-eb)
- Fixed: regression from 1.2.5 on calc() with value without leading 0 (#17 - @ben-eb)
- Fixed: regression from 1.2.5 on calc() with value without leading 0 (@MoOx)
- Fixed: regression from 1.2.5 on calc() on multiple lines (@MoOx)
- Fixed: security issue due to the usage of
eval()
. This is to avoid an arbitrary code execution. Now operations are resolved usingmath-expression-evaluator
- Fixed: zero values are not unitless anymore. Browsers do not calculate calc() with 0 unitless values. http://jsbin.com/punivivipo/edit?html,css,output (#11)
- Fixed: wrong rouding in some edge cases (#10)
- Fixed: Don't reduce expression containing CSS variables. (#9)
- Fixed: uppercase letters in units are now supported (#8)
- Decimal precision is now customisable as the
precision
option
- 5 decimals rounding for everything
- 5 decimals rounding for percentage
- Prevent infinite loop by adding a
Call stack overflow
- Correctly ignore unrecognized values (safer evaluation for nested expressions, see postcss/postcss-calc#2)
- Handle rounding issues (eg: 10% * 20% now give 2%, not 2.0000000000000004%)
- Fix issue when using mutiples differents prefixes in the same function
- support more complex formulas
- use
reduce-function-call
- better error message
First release
- based on rework-calc v1.1.0
- add error if the calc() embed an empty calc() or empty ()
- jscs + jshint added before tests