0.1.1 • Published 1 year ago

vuepress-plugin-imagemin v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vuepress-plugin-imagemin

This repo is forked and modified from vite-plugin-imagemin.

A VuePress plugin for compressing image assets

Install

npm i vuepress-plugin-imagemin -D

Usage

Configuration plugin in vite.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,
          },
        ],
      },
    }),
  ],
});

Options

paramstypedefaultdefault
verbosebooleantrueWhether to output the compressed result in the console
filterRegExp or (file: string) => boolean-Specify which resources are not compressed
disablebooleanfalseWhether to disable
svgoobject or false-See Options
gifsicleobject or false-See Options
mozjpegobject or false-See Options
optipngobject or false-See Options
pngquantobject or false-See Options
webpobject or false-See Options

Inspiration

License

MIT