vite-conf.js 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * 资源压缩配置
  3. */
  4. export const config_compression = {
  5. verbose: true, // 是否在控制台中输出压缩结果
  6. disable: false,
  7. threshold: 10240, // 如果体积大于阈值,将被压缩,单位为b,体积过小时请不要压缩,以免适得其反
  8. algorithm: 'gzip', // 压缩算法,可选['gzip',' brotliccompress ','deflate ','deflateRaw']
  9. ext: '.gz',
  10. deleteOriginFile: false // 源文件压缩后是否删除
  11. };
  12. /**
  13. * 图片压缩配置
  14. */
  15. export const config_imagemin = {
  16. gifsicle: {
  17. optimizationLevel: 7,
  18. interlaced: false
  19. },
  20. optipng: {
  21. optimizationLevel: 7
  22. },
  23. mozjpeg: {
  24. quality: 30
  25. },
  26. pngquant: {
  27. quality: [0.8, 0.9],
  28. speed: 4
  29. },
  30. svgo: {
  31. plugins: [
  32. {
  33. name: 'removeViewBox'
  34. },
  35. {
  36. name: 'removeEmptyAttrs',
  37. active: false
  38. }
  39. ]
  40. }
  41. };