File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change
1
+ import * as chokidar from 'chokidar'
1
2
import type { UserConfig } from '@vuepress/cli'
2
3
import type { DefaultThemeOptions } from '@vuepress/theme-default'
4
+ import { chalk , logger } from '@vuepress/utils'
3
5
import { navbar , sidebar } from './configs'
4
6
5
7
const config : UserConfig < DefaultThemeOptions > = {
6
8
base : '/' ,
7
9
8
- evergreen : process . env . NODE_ENV !== 'production' ,
9
-
10
10
head : [ [ 'link' , { rel : 'icon' , href : `/logo.png` } ] ] ,
11
11
12
12
// site-level locales config
@@ -115,6 +115,20 @@ const config: UserConfig<DefaultThemeOptions> = {
115
115
} ,
116
116
] ,
117
117
] ,
118
+
119
+ evergreen : process . env . NODE_ENV !== 'production' ,
120
+
121
+ onWatched : ( _ , restart ) => {
122
+ const watcher = chokidar . watch ( 'configs/**/*.ts' , {
123
+ cwd : __dirname ,
124
+ ignoreInitial : true ,
125
+ } )
126
+ watcher . on ( 'change' , async ( file ) => {
127
+ logger . info ( `file ${ chalk . magenta ( file ) } is modified` )
128
+ await watcher . close ( )
129
+ await restart ( )
130
+ } )
131
+ } ,
118
132
}
119
133
120
134
export = config
Original file line number Diff line number Diff line change 35
35
"@commitlint/config-conventional" : " ^11.0.0" ,
36
36
"@types/jest" : " ^26.0.19" ,
37
37
"anywhere" : " ^1.5.0" ,
38
+ "chokidar" : " ^3.5.1" ,
38
39
"cpx" : " ^1.5.0" ,
39
40
"cross-env" : " ^7.0.3" ,
40
41
"eslint" : " ^7.15.0" ,
You can’t perform that action at this time.
0 commit comments