프로젝트
GitHub에서 보기
vbenjs/vite-plugin-compression
소개
gzip 또는 Brotli로 리소스를 압축합니다.
학습 및 교육측정된 스타 증가
- in 24h
- -1
- in 7 days
- -1
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalvite-plugin-compression
English | 中文
Use gzip or brotli to compress resources.
Since vite-plugin-compress does not support gzip compression, a separate copy has been modified and some functions have been added.
Install (yarn or npm)
node version: >=12.0.0
vite version: >=2.0.0
yarn add vite-plugin-compression -D
or
npm i vite-plugin-compression -D
Usage
- Configuration plugin in vite.config.ts
import viteCompression from 'vite-plugin-compression';
export default () => {
return {
plugins: [viteCompression()],
};
};
Options
| params | type | default | default |
|---|---|---|---|
| verbose | boolean |
true |
Whether to output the compressed result in the console |
| filter | RegExp or (file: string) => boolean |
DefaultFilter |
Specify which resources are not compressed |
| disable | boolean |
false |
Whether to disable |
| threshold | number |
1025 |
It will be compressed if the volume is larger than threshold, the unit is b |
| algorithm | string |
gzip |
Compression algorithm, optional ['gzip','brotliCompress' ,'deflate','deflateRaw'] |
| ext | string |
.gz |
Suffix of the generated compressed package |
| compressionOptions | object |
- | The parameters of the corresponding compression algorithm |
| deleteOriginFile | boolean |
- | Whether to delete source files after compression |
DefaultFilter
/\.(js|mjs|json|css|html)$/i
Example
Run Example
cd ./example
yarn install
yarn test:gzip
yarn test:br
Sample project
License
MIT
Inspiration
관련 프로젝트 살펴보기
불러오는 중…