Blame view

build/vite/plugin/imagemin.ts 694 Bytes
vben authored
1
// Image resource files used to compress the output of the production environment
2
// https://github.com/anncwb/vite-plugin-imagemin
3
4
5
6
7
8
9
10
11
12
13
14
import viteImagemin from 'vite-plugin-imagemin';

export function configImageminPlugin() {
  const plugin = viteImagemin({
    gifsicle: {
      optimizationLevel: 7,
      interlaced: false,
    },
    optipng: {
      optimizationLevel: 7,
    },
    mozjpeg: {
15
      quality: 20,
16
17
    },
    pngquant: {
18
      quality: [0.8, 0.9],
19
20
21
22
23
      speed: 4,
    },
    svgo: {
      plugins: [
        {
24
          name: 'removeViewBox',
25
26
        },
        {
27
28
          name: 'removeEmptyAttrs',
          active: false,
29
30
31
32
33
34
        },
      ],
    },
  });
  return plugin;
}