mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
feat(@vant/cli): using esbuild to minify css (#10204)
This commit is contained in:
parent
48de3ca50b
commit
71a2e26259
@ -60,7 +60,6 @@
|
||||
"@vue/babel-plugin-jsx": "^1.1.1",
|
||||
"autoprefixer": "^10.4.0",
|
||||
"chalk": "^4.1.2",
|
||||
"clean-css": "^5.2.2",
|
||||
"commander": "^8.3.0",
|
||||
"consola": "^2.15.3",
|
||||
"conventional-changelog": "^3.1.24",
|
||||
|
@ -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;
|
||||
}
|
||||
|
1
packages/vant-cli/src/module.d.ts
vendored
1
packages/vant-cli/src/module.d.ts
vendored
@ -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';
|
||||
|
@ -94,7 +94,7 @@
|
||||
right: var(--van-padding-md);
|
||||
color: var(--van-gray-6);
|
||||
font-size: var(--van-address-list-edit-icon-size);
|
||||
transform: translate(0, -50%);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.van-cell {
|
||||
|
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
@ -104,7 +104,6 @@ importers:
|
||||
'@vue/babel-plugin-jsx': ^1.1.1
|
||||
autoprefixer: ^10.4.0
|
||||
chalk: ^4.1.2
|
||||
clean-css: ^5.2.2
|
||||
commander: ^8.3.0
|
||||
consola: ^2.15.3
|
||||
conventional-changelog: ^3.1.24
|
||||
@ -153,7 +152,6 @@ importers:
|
||||
'@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.16.0
|
||||
autoprefixer: 10.4.0_postcss@8.3.11
|
||||
chalk: 4.1.2
|
||||
clean-css: 5.2.2
|
||||
commander: 8.3.0
|
||||
consola: 2.15.3
|
||||
conventional-changelog: 3.1.24
|
||||
@ -2477,13 +2475,6 @@ packages:
|
||||
source-map: 0.6.1
|
||||
dev: false
|
||||
|
||||
/clean-css/5.2.2:
|
||||
resolution: {integrity: sha1-06fG7iURAR4FFxmDi9z4MU3EVI0=, tarball: clean-css/download/clean-css-5.2.2.tgz}
|
||||
engines: {node: '>= 10.0'}
|
||||
dependencies:
|
||||
source-map: 0.6.1
|
||||
dev: false
|
||||
|
||||
/clean-stack/2.2.0:
|
||||
resolution: {integrity: sha1-7oRy27Ep5yezHooQpCfe6d/kAIs=, tarball: clean-stack/download/clean-stack-2.2.0.tgz}
|
||||
engines: {node: '>=6'}
|
||||
|
Loading…
x
Reference in New Issue
Block a user