PostCSS plugin to remove units from zero lengths.
Given any of the following css rules:
.foo { width: 0em; }
.foo { width: 0ex; }
.foo { width: 0ch; }
.foo { width: 0vw; }
.foo { width: 0vh; }
.foo { width: 0cm; }
.foo { width: 0mm; }
.foo { width: 0in; }
.foo { width: 0pt; }
.foo { width: 0pc; }
.foo { width: 0px; }
.foo { width: 0rem; }
.foo { width: 0vmin; }
.foo { width: 0vmax; }
They will be transformed to:
.foo { width: 0; }
Unhandled Cases
Currently, the plugin only handles zero lengths in declarations. It does not handle:
- Zero lengths in media queries.
- Zero lengths in functions.
- Any other zero lengths.
Usage
postcss([ require('postcss-strip-zero-length-units') ])
See PostCSS docs for examples for your environment.