vite.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import { defineConfig } from 'vite';
  2. import { svelte } from '@sveltejs/vite-plugin-svelte';
  3. import UnoCSS from 'unocss/vite';
  4. import extractorSvelte from '@unocss/extractor-svelte';
  5. import svgSprite from 'rollup-plugin-stdf-icon';
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. // @ts-ignore
  9. plugins: [
  10. // @ts-ignore
  11. UnoCSS({
  12. extractors: [extractorSvelte()],
  13. }),
  14. svelte({
  15. onwarn(warning, defaultHandler) {
  16. if (warning.code.startsWith('a11y-')) {
  17. return;
  18. }
  19. // handle all other warnings normally
  20. defaultHandler(warning);
  21. },
  22. }),
  23. // 一般来说,一个应用的的 svg 不多时都放在一个文件夹下,合并为一个 symbol 即可。此处演示了不同文件夹下的图标如何合并为不同的 symbol。
  24. // 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.
  25. svgSprite([
  26. { inFile: 'src/assets/Heroicons', outFile: 'public/fonts' },
  27. { inFile: 'src/assets/IconPark', outFile: 'public/fonts' },
  28. { inFile: 'src/assets/Remix', outFile: 'public/fonts' },
  29. ]),
  30. ],
  31. });