PostCSS Define Units
PostCSS plugin define custom units.
So simple. Use --define
property. Unit define globally.
There are two ways to define a unit. First one is just a unit representation. Second one is an expression.
Expression must be surrounded by the parenthesis and it also should be ended with css unit, like so: (value * 10)px
. Where value
is a variable that holds a user defined unit value. Code inside parenthesies is just a JavScript, so you could use any of it functionality.
Result:
Usage