Skip to content

Commit

Permalink
feat(projects): 添加SvgIcon,配置vite plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Liushengqun committed Feb 25, 2022
1 parent 50c8b9d commit 378d55a
Show file tree
Hide file tree
Showing 29 changed files with 1,121 additions and 3 deletions.
3 changes: 2 additions & 1 deletion build/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import iconify from './iconify';
import windicss from './windicss';
import mock from './mock';
import visualizer from './visualizer';
import svgSprite from './svgSprite';

export function setupVitePlugins(configEnv: ConfigEnv): (PluginOption | PluginOption[])[] {
const plugins = [vue, html(configEnv), ...iconify, windicss, mock];
const plugins = [vue, html(configEnv), ...iconify, windicss, mock, svgSprite];

if (configEnv.command === 'build') {
plugins.push(visualizer);
Expand Down
7 changes: 7 additions & 0 deletions build/plugins/svgSprite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import path from 'path';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';

export default createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
symbolId: 'icon-[dir]-[name]'
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"vite": "2.8.4",
"vite-plugin-html": "^3.0.6",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-windicss": "^1.7.1",
"vue-tsc": "^0.32.0",
"vueuc": "^0.4.26",
Expand Down
Loading

0 comments on commit 378d55a

Please sign in to comment.