vite.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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. plugins: [
  9. UnoCSS({
  10. extractors: [extractorSvelte()],
  11. }),
  12. svelte({
  13. onwarn(warning, defaultHandler) {
  14. if (warning.code.startsWith('a11y-')) {
  15. return;
  16. }
  17. // handle all other warnings normally
  18. defaultHandler(warning);
  19. },
  20. }),
  21. // 一般来说,一个应用的所有 svg 都放在一个文件夹下,合并为一个 symbol 即可。
  22. // 如默认配置的 src/assets/icons 内,合并之后 symbol 会放置于 public/fonts/symbol.svg 下。
  23. // 此处只是为了演示不同文件夹下的图标如何合并为不同的 symbol。
  24. // Generally speaking, all of an application svg are placed in a folder and merged into one symbol.
  25. // As in the default configuration of src/assets/icons, the merged symbol will be placed under public/fonts/symbol.svg.
  26. // Here is just to show how icons in different folders are merged into different symbols.
  27. svgSprite([
  28. { inFile: 'src/assets/Heroicons', outFile: 'public/fonts', fileName: 'Heroicons' },
  29. { inFile: 'src/assets/IconPark', outFile: 'public/fonts', fileName: 'IconPark' },
  30. { inFile: 'src/assets/Remix', outFile: 'public/fonts', fileName: 'Remix' },
  31. ]),
  32. ],
  33. });