mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
feat(cli): use clean-css to minify css
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import postcss from 'postcss';
|
||||
import postcssrc from 'postcss-load-config';
|
||||
import { minify } from 'csso';
|
||||
import CleanCss from 'clean-css';
|
||||
import { POSTCSS_CONFIG_FILE } from '../common/constant';
|
||||
|
||||
const cleanCss = new CleanCss();
|
||||
|
||||
export async function compileCss(source: string | Buffer) {
|
||||
const config = await postcssrc({}, POSTCSS_CONFIG_FILE);
|
||||
const { css } = await postcss(config.plugins as any).process(source, {
|
||||
from: undefined
|
||||
});
|
||||
|
||||
return minify(css).css;
|
||||
return cleanCss.minify(css).styles;
|
||||
}
|
||||
|
Reference in New Issue
Block a user