Halo 2.x 插件开发快速开始模板。
开发环境
插件开发的详细文档请查阅:https://docs.halo.run/developer-guide/plugin/introduction
所需环境:
- JDK 21
- Node 20
- pnpm 9
- Docker (可选)
克隆项目:
git clone git@github.com:halo-sigs/plugin-starter.git
# 或者当你 fork 之后
git clone git@github.com:{your_github_id}/plugin-starter.gitcd path/to/plugin-starter运行方式 1(推荐)
此方式需要本地安装 Docker
# macOS / Linux ./gradlew pnpmInstall # Windows ./gradlew.bat pnpmInstall
# macOS / Linux ./gradlew haloServer # Windows ./gradlew.bat haloServer
执行此命令后,会自动创建一个 Halo 的 Docker 容器并加载当前的插件,更多文档可查阅:https://docs.halo.run/developer-guide/plugin/basics/devtools
运行方式 2
此方式需要使用源码运行 Halo
编译插件:
# macOS / Linux ./gradlew build # Windows ./gradlew.bat build
修改 Halo 配置文件:
halo: plugin: runtime-mode: development fixedPluginPath: - "/path/to/plugin-starter"
最后重启 Halo 项目即可。