vite.config.js 1.3 KB

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