feat(@vant/cli): using esbuild to minify css (#10204)
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import postcss from 'postcss';
|
||||
import postcssrc from 'postcss-load-config';
|
||||
import CleanCss from 'clean-css';
|
||||
import { transform } from 'esbuild';
|
||||
import { POSTCSS_CONFIG_FILE } from '../common/constant.js';
|
||||
|
||||
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 cleanCss.minify(css).styles;
|
||||
const result = await transform(css, {
|
||||
loader: 'css',
|
||||
minify: true,
|
||||
target: ['chrome53', 'safari10'],
|
||||
});
|
||||
return result.code;
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -1,7 +1,6 @@
|
||||
// some modules with missing type definitions
|
||||
declare module 'execa';
|
||||
declare module 'hash-sum';
|
||||
declare module 'clean-css';
|
||||
declare module 'release-it';
|
||||
declare module 'conventional-changelog';
|
||||
declare module '@vant/markdown-vetur';
|
||||
|
||||
Reference in New Issue
Block a user