vite.config.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import postcss from './postcss.config.js';
  2. import { defineConfig } from 'vite';
  3. import { svelte } from '@sveltejs/vite-plugin-svelte';
  4. import svgSprite from 'rollup-plugin-stdf-icon';
  5. // https://vitejs.dev/config/
  6. // @ts-ignore
  7. export default defineConfig({
  8. // @ts-ignore
  9. plugins: [
  10. svelte({
  11. onwarn(warning, defaultHandler) {
  12. if (warning.code.startsWith('a11y-')) {
  13. return;
  14. }
  15. // handle all other warnings normally
  16. defaultHandler(warning);
  17. },
  18. }),
  19. // 一般来说,一个应用的的 svg 不多时都放在一个文件夹下,合并为一个 symbol 即可。此处演示了不同文件夹下的图标如何合并为不同的 symbol。
  20. // Generally speaking, when the svg of an application is not much, it is placed in a folder and merged into one symbol. This example shows how the icons in different folders are merged into different symbols.
  21. svgSprite([
  22. { inFile: 'src/assets/Heroicons', outFile: 'public/fonts' },
  23. { inFile: 'src/assets/IconPark', outFile: 'public/fonts' },
  24. { inFile: 'src/assets/Remix', outFile: 'public/fonts' },
  25. ]),
  26. ],
  27. // @ts-ignore
  28. css: { postcss },
  29. });