css-collapse-values
Collapse CSS values into their shortest form.
Given property values that behave similar to margin
:
/* collapsed: */
Collapse them into their shortest form using this module:
const collapse = ; ;// => ['1px', '2px'] ;// => ['2em', '4em', '6em'] ;// => ['10%', '30%']
Uses css-truncate-values
to get the shortest possible results.
Installation
$ npm install --save css-collapse-values
API
collapse(values)
Collapse the values, always returning an array.
values
(Array
): An array of 4 or less CSS number values. (i.e.['1em', '2em', '1em']
)
// => ['10px'] ;// => ['-.1em', '5px']
Also See
postcss-collapse: A postcss version of this.
css-truncate-values: Truncate CSS numbers while retaining the original value.
css-strip-units: Strip the unit off a CSS number.
License
MIT © Jamen Marz