(code: string | Container, options: OptimizeOptions = {})
| 12 | } |
| 13 | |
| 14 | export function optimizePostCss(code: string | Container, options: OptimizeOptions = {}) { |
| 15 | const { minify = false } = options |
| 16 | |
| 17 | // prettier-ignore |
| 18 | const plugins = [ |
| 19 | nested(), |
| 20 | dedupe(), |
| 21 | mergeRules(), |
| 22 | discardEmpty(), |
| 23 | ] |
| 24 | |
| 25 | if (minify) { |
| 26 | plugins.push(normalizeWhiteSpace(), minifySelectors()) |
| 27 | } else { |
| 28 | plugins.push(prettify() as any) |
| 29 | } |
| 30 | |
| 31 | const { css } = postcss(plugins).process(code) |
| 32 | return css |
| 33 | } |
no test coverage detected