プロジェクト
概要
gzipまたはBrotliでリソースを圧縮します。
学習・教育計測したスター増加
- 24時間
- -1
- 7日間
- -1
- 15日間
- -1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルvite-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
関連プロジェクトを探す
読み込み中…