File tree Expand file tree Collapse file tree 9 files changed +39
-8
lines changed
template/vitepress-plugin-slot-inject-template Expand file tree Collapse file tree 9 files changed +39
-8
lines changed Original file line number Diff line number Diff line change 44
55### Patch Changes
66
7+ - feat: 支持按需开启 group-icons 插件
78- fix: 一些 SVG 图标 iOS 不渲染
89- fix: 日期在 iOS 上显示 NaN
910- fix: 作品页样式塌陷
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export const blogTheme = getThemeConfig({
1515 locales : {
1616 en : themeEN
1717 } ,
18+ // groupIcon: false,
1819 // formatShowDate: {
1920 // justNow: '不久前',
2021 // minutesAgo: ' minutes ago',
Original file line number Diff line number Diff line change 11---
22title : 更新日志
3- description : 最近更新(v0.5.5) ⏰ 2025/07/01 :系列bug修复
3+ description : 最近更新(v0.5.5) ⏰ 2025/07/03 :系列bug修复
44author : 粥里有勺糖
55top : 3
66tag : 日志
@@ -27,10 +27,11 @@ bun install vitepress@latest
2727```
2828:::
2929
30- ## 0.5.5 (2025/07/01 )
30+ ## 0.5.5 (2025/07/03 )
3131
3232### Patch Changes
3333
34+ - feat: 支持按需开启 group-icons 插件
3435- fix: 一些 SVG 图标 iOS 不渲染
3536- fix: 日期在 iOS 上显示 NaN
3637- fix: 作品页样式塌陷
Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ const blogTheme = getThemeConfig({
4747})
4848```
4949
50+ 也可以关闭这个功能
51+
52+ ``` ts
53+ const blogTheme = getThemeConfig ({
54+ groupIcon: false
55+ })
56+ ```
57+
5058## oml2d - 看板娘集成
5159* Type:[ oml2dOptions] ( https://oml2d.hacxy.cn/api/interfaces/Options.html )
5260
Original file line number Diff line number Diff line change @@ -467,7 +467,7 @@ export namespace Theme {
467467 imageStyle ?: ImageStyleConfig
468468 groupIcon ?: {
469469 customIcon : Record < string , string >
470- }
470+ } | false
471471 }
472472
473473 export type FormatShowDate = {
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ import UserWorksPage from './components/UserWorks.vue'
3535// 内置一些特殊的主题色
3636import './styles/theme/inline-theme.var.css'
3737
38- // 导入group icons
39- import 'virtual:group-icons.css'
38+ // 导入group icons,改由自定义插件导入
39+ // import 'virtual:group-icons.css'
4040
4141export const BlogTheme : Theme = {
4242 ...DefaultTheme ,
Original file line number Diff line number Diff line change @@ -32,7 +32,9 @@ export function getMarkdownPlugins(cfg?: Partial<Theme.BlogConfig>) {
3232 markdownPlugin . push ( timeline )
3333 }
3434
35- markdownPlugin . push ( groupIconMdPlugin )
35+ if ( cfg ?. groupIcon !== false ) {
36+ markdownPlugin . push ( groupIconMdPlugin )
37+ }
3638
3739 return markdownPlugin
3840}
Original file line number Diff line number Diff line change @@ -56,12 +56,29 @@ export function getVitePlugins(cfg: Partial<Theme.BlogConfig> = {}) {
5656 }
5757
5858 // 内置支持 group icon
59-
60- plugins . push ( groupIconVitePlugin ( cfg ?. groupIcon ) )
59+ if ( cfg ?. groupIcon !== false ) {
60+ plugins . push ( patchGroupIconPlugin ( ) )
61+ plugins . push ( groupIconVitePlugin ( cfg ?. groupIcon ) )
62+ }
6163
6264 return plugins
6365}
6466
67+ export function patchGroupIconPlugin ( ) {
68+ return {
69+ name : '@sugarat/theme-plugin-patch-group-icon' ,
70+ enforce : 'pre' ,
71+ transform ( code : string , id : string ) {
72+ // 匹配 theme/index.ts 或 theme/index.js 文件
73+ if ( id . match ( / [ \/ \\ ] t h e m e [ \/ \\ ] i n d e x \. ( t s | j s ) $ / ) ) {
74+ // 在文件顶部插入 import 语句
75+ return `import 'virtual:group-icons.css'\n${ code } `
76+ }
77+ return code
78+ }
79+ }
80+ }
81+
6582export function registerVitePlugins ( vpCfg : any , plugins : any [ ] ) {
6683 vpCfg . vite = {
6784 plugins,
Original file line number Diff line number Diff line change 11{
22 "name" : " vitepress-plugin-slot-inject-template" ,
33 "version" : " 0.1.0" ,
4+ "private" : true ,
45 "description" : " vitepress plugin, slot template" ,
56 "author" : " sugar" ,
67 "license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments