🎨更换web页面框架
This commit is contained in:
39
web/build/index.js
Normal file
39
web/build/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**********************************
|
||||
* @Author: Ronnie Zhang
|
||||
* @LastEditor: Ronnie Zhang
|
||||
* @LastEditTime: 2023/12/04 22:48:02
|
||||
* @Email: zclzone@outlook.com
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import path from 'node:path'
|
||||
import { globSync } from 'glob'
|
||||
import dynamicIcons from '../src/assets/icons/dynamic-icons'
|
||||
|
||||
/**
|
||||
* @usage 生成icons, 用于 unocss safelist,以支持页面动态渲染自定义图标
|
||||
*/
|
||||
export function getIcons() {
|
||||
const feFiles = globSync('src/assets/icons/feather/*.svg', { nodir: true, strict: true })
|
||||
const meFiles = globSync('src/assets/icons/isme/*.svg', { nodir: true, strict: true })
|
||||
const feIcons = feFiles.map((filePath) => {
|
||||
const fileName = path.basename(filePath) // 获取文件名,包括后缀
|
||||
const fileNameWithoutExt = path.parse(fileName).name // 获取去除后缀的文件名
|
||||
return `i-fe:${fileNameWithoutExt}`
|
||||
})
|
||||
const meIcons = meFiles.map((filePath) => {
|
||||
const fileName = path.basename(filePath) // 获取文件名,包括后缀
|
||||
const fileNameWithoutExt = path.parse(fileName).name // 获取去除后缀的文件名
|
||||
return `i-me:${fileNameWithoutExt}`
|
||||
})
|
||||
|
||||
return [...dynamicIcons, ...feIcons, ...meIcons]
|
||||
}
|
||||
|
||||
/**
|
||||
* @usage 生成.vue文件路径列表,用于添加菜单时可下拉选择对应的.vue文件路径,防止手动输入报错
|
||||
*/
|
||||
export function getPagePathes() {
|
||||
const files = globSync('src/views/**/*.vue')
|
||||
return files.map(item => `/${path.normalize(item).replace(/\\/g, '/')}`)
|
||||
}
|
25
web/build/plugin-isme/icons.js
Normal file
25
web/build/plugin-isme/icons.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**********************************
|
||||
* @Author: Ronnie Zhang
|
||||
* @LastEditor: Ronnie Zhang
|
||||
* @LastEditTime: 2023/12/04 22:48:11
|
||||
* @Email: zclzone@outlook.com
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { getIcons } from '..'
|
||||
|
||||
const PLUGIN_ICONS_ID = 'isme:icons'
|
||||
export function pluginIcons() {
|
||||
return {
|
||||
name: 'isme:icons',
|
||||
resolveId(id) {
|
||||
if (id === PLUGIN_ICONS_ID)
|
||||
return `\0${PLUGIN_ICONS_ID}`
|
||||
},
|
||||
load(id) {
|
||||
if (id === `\0${PLUGIN_ICONS_ID}`) {
|
||||
return `export default ${JSON.stringify(getIcons())}`
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
10
web/build/plugin-isme/index.js
Normal file
10
web/build/plugin-isme/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**********************************
|
||||
* @Author: Ronnie Zhang
|
||||
* @LastEditor: Ronnie Zhang
|
||||
* @LastEditTime: 2023/12/04 22:48:17
|
||||
* @Email: zclzone@outlook.com
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
export { pluginPagePathes } from './page-pathes'
|
||||
export { pluginIcons } from './icons'
|
25
web/build/plugin-isme/page-pathes.js
Normal file
25
web/build/plugin-isme/page-pathes.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**********************************
|
||||
* @Author: Ronnie Zhang
|
||||
* @LastEditor: Ronnie Zhang
|
||||
* @LastEditTime: 2023/12/05 21:37:43
|
||||
* @Email: zclzone@outlook.com
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { getPagePathes } from '..'
|
||||
|
||||
const PLUGIN_PAGE_PATHES_ID = 'isme:page-pathes'
|
||||
export function pluginPagePathes() {
|
||||
return {
|
||||
name: 'isme:page-pathes',
|
||||
resolveId(id) {
|
||||
if (id === PLUGIN_PAGE_PATHES_ID)
|
||||
return `\0${PLUGIN_PAGE_PATHES_ID}`
|
||||
},
|
||||
load(id) {
|
||||
if (id === `\0${PLUGIN_PAGE_PATHES_ID}`) {
|
||||
return `export default ${JSON.stringify(getPagePathes())}`
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user