mirror of https://github.com/YunYouJun/valaxy
release: v0.15.8
This commit is contained in:
parent
c285d80795
commit
c0b8f75387
|
@ -35,3 +35,29 @@ end: false
|
|||
pnpm create valaxy
|
||||
# choose template addon
|
||||
```
|
||||
|
||||
### 使用生命周期钩子
|
||||
|
||||
如示例所示,插件可以使用 `valaxy.hook` 来挂载生命周期钩子。
|
||||
实现在构建前/后以及其他节点做一些事情。
|
||||
|
||||
> 请参考 [生命周期钩子](/guide/custom/hooks) 了解更多。
|
||||
|
||||
```ts {11-14}
|
||||
import { defineValaxyAddon } from 'valaxy'
|
||||
import consola from 'consola'
|
||||
import pkg from '../package.json'
|
||||
|
||||
export const addonTest = defineValaxyAddon(options => ({
|
||||
name: pkg.name,
|
||||
enable: true,
|
||||
options,
|
||||
|
||||
setup(valaxy) {
|
||||
valaxy.hook('build:before', () => {
|
||||
// do something before build
|
||||
consola.log('build:before')
|
||||
})
|
||||
},
|
||||
}))
|
||||
```
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@valaxyjs/monorepo",
|
||||
"type": "module",
|
||||
"version": "0.15.7",
|
||||
"version": "0.15.8",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@8.9.2",
|
||||
"description": "📄 Vite & Vue powered static blog generator.",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "create-valaxy",
|
||||
"type": "module",
|
||||
"version": "0.15.7",
|
||||
"version": "0.15.8",
|
||||
"description": "Create Starter Template for Valaxy",
|
||||
"author": {
|
||||
"email": "me@yunyoujun.cn",
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"serve": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"valaxy": "0.15.7",
|
||||
"valaxy-theme-yun": "0.15.7"
|
||||
"valaxy": "0.15.8",
|
||||
"valaxy-theme-yun": "0.15.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.2.2"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "valaxy-theme-press",
|
||||
"version": "0.15.7",
|
||||
"version": "0.15.8",
|
||||
"description": "Docs Theme for Valaxy",
|
||||
"author": {
|
||||
"email": "me@yunyoujun.cn",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "valaxy-theme-yun",
|
||||
"version": "0.15.7",
|
||||
"version": "0.15.8",
|
||||
"author": {
|
||||
"email": "me@yunyoujun.cn",
|
||||
"name": "YunYouJun",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "valaxy",
|
||||
"type": "module",
|
||||
"version": "0.15.7",
|
||||
"version": "0.15.8",
|
||||
"description": "📄 Vite & Vue powered static blog generator.",
|
||||
"author": {
|
||||
"email": "me@yunyoujun.cn",
|
||||
|
|
Loading…
Reference in New Issue