0.2.8 • Published 12 months ago
esc-plugin v0.2.8
ESC 系统优化插件
介绍
esc-plugin 插件是一个基于 vite 环境在处理打包时的一些操作的插件. 插件包含:
- 打包进度条
- 打包之后生成项目压缩包
用法
- 安装
# npm
npm i esc-plugin -D
# yarn
yarn add esc-plugin -D
# pnpm
pnpm i esc-plugin -D
- 使用:在
vite.config.js / vite.config.ts
中配置
import { zip, progress } from 'esc-plugin';
export default {
plugins: [
progress(),
zip({
type: 'zip',
archiverName: 'newboard.zip',
sourceName: 'newboard',
}),
],
};
progress 插件
- 参数:
format
:自定义进度条的格式;width
:进度条在终端中的宽度;complete
:完成后的默认字符\u2588
;incomplete
:未完成的默认字符\u2591
;renderThrottle
:间隔更新时间默认 16(毫秒);clear
:完成后是否清除终端,默认 false;callback
:完成后执行的回调函数;stream
终端中的输出格式流,默认stderr
;head
:进度条的头字符;srcDir
:构建文件的目录,默认是src
;
- 参数 options 中的
format
中各个标记含义:
:bar
:代表进度条;:current
:当前执行到哪的刻度;:total
:总刻度;:elapsed
:所用时间(秒);:percent
:完成的百分比;:allTime
:预计完成时间(秒);:rate
:每一秒的速率;
- 使用(带参数):
// vite.config.js / vite.config.ts
import { progress } from 'esc-plugin';
export default {
plugins: [
progress({
format: 'building [:bar] :percent',
total: 200,
width: 60,
complete: '=',
incomplete: '',
}),
],
};
zip 插件
- 参数:
type
:压缩包格式;archiverName
:压缩包文件名;sourceName
:需要压缩的文件夹;
- 使用(带参数):
// vite.config.js / vite.config.ts
import { progress } from 'esc-plugin';
export default {
plugins: [
zip({
type: 'zip',
archiverName: 'xxx.zip',
sourceName: 'xxx',
}),
],
};
0.2.1
12 months ago
0.2.0
12 months ago
0.2.7
12 months ago
0.1.8
12 months ago
0.2.6
12 months ago
0.1.7
12 months ago
0.2.8
12 months ago
0.1.9
12 months ago
0.2.3
12 months ago
0.2.2
12 months ago
0.2.5
12 months ago
0.2.4
12 months ago
0.1.6
1 year ago
0.1.4
1 year ago
0.1.5
1 year ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.3
2 years ago
0.1.0
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago