refactor: custom icon

This commit is contained in:
张传龙
2022-08-27 11:46:34 +08:00
parent 2f1b747243
commit 0cefadc2a5
15 changed files with 1024 additions and 12 deletions

View File

@@ -10,10 +10,11 @@ import IconsResolver from 'unplugin-icons/resolver'
* 图标库: https://icones.js.org/
*/
import Icons from 'unplugin-icons/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { getRootPath } from '../utils'
const customIconPath = getRootPath('src', 'assets/icons')
const customIconPath = getRootPath('src', 'assets/svg')
export default [
AutoImport({
imports: ['vue', 'vue-router'],
@@ -31,4 +32,10 @@ export default [
resolvers: [NaiveUiResolver(), IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })],
dts: false,
}),
createSvgIconsPlugin({
iconDirs: [customIconPath],
symbolId: 'icon-custom-[dir]-[name]',
inject: 'body-last',
customDomId: '__CUSTOM_SVG_ICON__',
}),
]