
用Git子模块方式使用主题
使用Git子模块的方式,把源码放项目主题目录。
- 主题 Github 源码仓库:https://github.com/mosongcc/vitepress-theme
- 主题 Gitee 源码仓库:https://gitee.com/mosongcc/vitepress-theme
步骤一:
创建VitePress项目
目录结构:
.
├─ docs
│ ├─ .vitepress
│ │ └─ config.js
│ ├─ api-examples.md
│ ├─ markdown-examples.md
│ └─ index.md
└─ package.json
步骤二:
进入目录docs/.vitepress/
执行命令:
git submodule add https://github.com/mosongcc/vitepress-theme theme
仓库克隆到目录docs/.vitepress/theme/
。
如果需要对主题做自定义修改,可以先Fork
后再用自己的仓库。
当主题有更新时,可以执行Git命令获取最新代码
git submodule pull
特别是多个项目使用同一个主题时,使用Git子模块会很方便管理更新。
步骤三:
启动服务,验证功能。