vite.config.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2012-2021 Zammad Foundation, https://zammad-foundation.org/
  2. import { defineConfig } from 'vite'
  3. import RubyPlugin from 'vite-plugin-ruby'
  4. import VuePlugin from '@vitejs/plugin-vue'
  5. import viteSvgIcons from 'vite-plugin-svg-icons'
  6. import type { OptimizeOptions } from 'svgo'
  7. import * as path from 'path'
  8. export default defineConfig({
  9. resolve: {
  10. alias: {
  11. '@mobile': path.resolve(__dirname, 'app/frontend/apps/mobile'),
  12. '@common': path.resolve(__dirname, 'app/frontend/common'),
  13. },
  14. },
  15. plugins: [
  16. RubyPlugin(),
  17. VuePlugin(),
  18. viteSvgIcons({
  19. // Specify the icon folder to be cached
  20. iconDirs: [path.resolve(process.cwd(), 'public/assets/images/icons')],
  21. // Specify symbolId format
  22. symbolId: 'icon-[dir]-[name]',
  23. svgoOptions: {
  24. plugins: [
  25. { name: 'preset-default' },
  26. {
  27. name: 'removeAttributesBySelector',
  28. params: {
  29. selectors: [
  30. {
  31. selector: "[fill='#50E3C2']",
  32. attributes: 'fill',
  33. },
  34. {
  35. selector: "[fill='#BD0FE1']",
  36. attributes: 'fill',
  37. },
  38. {
  39. selector: "[fill='#BD10E0']",
  40. attributes: 'fill',
  41. },
  42. ],
  43. },
  44. },
  45. ],
  46. } as OptimizeOptions,
  47. }),
  48. ],
  49. })