imagemin.ts 657 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Image resource files used to compress the output of the production environment
  2. import viteImagemin from 'vite-plugin-imagemin';
  3. export function configImageminPlugin() {
  4. const plugin = viteImagemin({
  5. gifsicle: {
  6. optimizationLevel: 7,
  7. interlaced: false,
  8. },
  9. optipng: {
  10. optimizationLevel: 7,
  11. },
  12. webp: {
  13. quality: 75,
  14. },
  15. mozjpeg: {
  16. quality: 65,
  17. },
  18. pngquant: {
  19. quality: [0.65, 0.9],
  20. speed: 4,
  21. },
  22. svgo: {
  23. plugins: [
  24. {
  25. removeViewBox: false,
  26. },
  27. {
  28. removeEmptyAttrs: false,
  29. },
  30. ],
  31. },
  32. });
  33. return plugin;
  34. }