Convert values with PostCSS (e.g. ms -> s)
npm install postcss-convert-values> Convert values with PostCSS (e.g. ms -> s)
With npm do:
```
npm install postcss-convert-values --save
This plugin reduces CSS size by converting values to use different units
where possible; for example, 500ms can be represented as .5s. You can
read more about these units in [this article][csstricks].
`css`
h1 {
font-size: 16px;
width: 0em
}
`css`
h1 {
font-size: 1pc;
width: 0
}
Note that this plugin only covers conversions for duration and absolute length
values. For color conversions, use [postcss-colormin][colormin].
#### options
##### length
Type: booleantrue
Default:
Pass false to disable conversion from px to other absolute length units,pc
such as & pt & vice versa.
##### time
Type: booleantrue
Default:
Pass false to disable conversion from ms to s & vice versa.
##### angle
Type: booleantrue
Default:
Pass false to disable conversion from deg to turn & vice versa.
##### precision
Type: boolean|numberfalse
Default:
Specify any numeric value here to round px values to that many decimal places;{precision: 2}
for example, using will round 6.66667px to 6.67px, and{precision: 0} will round it to 7px. Passing false (the default) will
leave these values as is.
It is recommended for most use cases to set this option to 2`.
See the PostCSS documentation for
examples for your environment.
See CONTRIBUTORS.md.
MIT © Ben Briggs
[postcss]: https://github.com/postcss/postcss
[csstricks]: https://css-tricks.com/the-lengths-of-css/