@porsche-design-system/components-react
Version:
Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.
10 lines (8 loc) • 351 B
JavaScript
const minifyCss = (css) => {
// TODO: could remove whitespace in selectors following
// - before/after + combinator, e.g. ` + ` -> should not be removed within calc()
return css
.replace(/\s\s+|\.\\(?=:)|[\n\\]+(?!\+)| (?={)|;(?=\s+})|(:|media)\s(?=.*;?)/g, '$1')
.replace(/\s?(,|>|~)\s/g, '$1');
};
export { minifyCss };