The calc plugin will precalculate all calc() expression within CSS values as much as possible.
Note: It cannot resolve mixed units e.g.
%andpx.
yarn add bredon-plugin-calcYou may alternatively use npm i --save bredon-plugin-calc.
import { compile } from 'bredon'
import calcPlugin from 'bredon-plugin-calc'
const input = 'calc(100% - 2*30%) calc(100% - 50px)'
const output = compile(input, {
plugins: [
calcPlugin()
]
})
console.log(output)
// => 40% calc(100% - 50px)Bredon is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with ♥ by @rofrischmann and all the great contributors.