vuepress-plugin-imagemin
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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

params type default default
verbose boolean true Whether to output the compressed result in the console
filter RegExp or (file: string) => boolean - 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

Inspiration

License

MIT

Package Sidebar

Install

npm i vuepress-plugin-imagemin

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

22 kB

Total Files

6

Last publish

Collaborators

  • yjl9903