Skip to content

WangJincheng4869/vite-plugin-compression

 
 

Repository files navigation

codecov

Install

$ yarn add vite-plugin-compression2 -D

# or

$ npm install vite-plugin-compression2 -D

Usage

import { defineConfig } from 'vite'

import { compression } from 'vite-plugin-compression2'

export default defineConfig({
  plugins: [
    // ...your plugin
    compression()
  ]
})

Options

params type default description
include string | RegExp | Array<string | RegExp> `/.(html|xml|css|json|js|mjs|svg yaml
exclude string | RegExp | Array<string | RegExp> - Exclude all assets matching any of these conditions.
threshold number 0 Only assets bigger than this size are processed (in bytes)
algorithm string| function gzip The compression algorithm
compressionOptions Record<string,any> {} Compression options for algorithm(details see zlib module)
deleteOriginalAssets boolean false Whether to delete the original assets or not
skipIfLargerOrEqual boolean true Whether to skip the compression if the result is larger than or equal to the original file
filename string [path][base].gz The target asset filename

Q & A

FAQ

Others

  • If you want to analysis your bundle assets. Maybe you can try vite-bundle-analyzer

  • tarball option dest means to generate a tarball somewhere

  • tarball is based on the ustart. It should be compatible with all popular tar distributions out there (gnutar, bsdtar etc)

Sponsors

LICENSE

MIT

Author

Kanno

About

vite plugin. compress your bundle file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 87.8%
  • HTML 6.0%
  • JavaScript 4.0%
  • CSS 1.3%
  • Makefile 0.9%