vite.config.js 1.2 KB

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