Skip to content

Latest commit

 

History

History

bredon-plugin-calc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

bredon-plugin-calc

npm version npm downloads

The calc plugin will precalculate all calc() expression within CSS values as much as possible.

Note: It cannot resolve mixed units e.g. % and px.

Installation

yarn add bredon-plugin-calc

You may alternatively use npm i --save bredon-plugin-calc.

Usage

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)

License

Bredon is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with ♥ by @rofrischmann and all the great contributors.