This repo is forked and modified from vite-plugin-imagemin.
A VuePress plugin for compressing image assets
npm i vuepress-plugin-imagemin -D
Configuration plugin in .vuepress/config.ts
import { defineUserConfig } from 'vuepress';
import Imagemin from 'vuepress-plugin-imagemin'
export default defineUserConfig({
plugins: [
Imagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpeg: {
quality: 20,
},
pngquant: {
quality: [0.8, 0.9],
speed: 4,
},
svgo: {
plugins: [
{
name: 'removeViewBox',
},
{
name: 'removeEmptyAttrs',
active: false,
},
],
},
}),
],
});
params | type | default | default |
---|---|---|---|
verbose | boolean |
true |
Whether to output the compressed result in the console |
include | RegExp or RegExp[] |
- | Specify which resources are compressed |
exclude | RegExp or RegExp[] |
- | Specify which resources are not compressed |
disable | boolean |
false |
Whether to disable |
svgo | object or false |
- | See Options |
gifsicle | object or false |
- | See Options |
mozjpeg | object or false |
- | See Options |
optipng | object or false |
- | See Options |
pngquant | object or false |
- | See Options |
webp | object or false |
- | See Options |
npm run dev:play
npm run dev:build
MIT