Skip to content

Commit

Permalink
Merge pull request #48 from Lsq128/main
Browse files Browse the repository at this point in the history
feat(projects): 添加SvgIcon,配置vite plugin
  • Loading branch information
honghuangdc authored Feb 25, 2022
2 parents 50c8b9d + 378d55a commit 1a9efee
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

1 comment on commit 1a9efee

@vercel
Copy link

@vercel vercel bot commented on 1a9efee Feb 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.