watch for custom provided templates on edit event

This commit is contained in:
Pooya Parsa 2017-05-12 12:57:06 +04:30
parent 12727d1165
commit 5d23dfc49e

View File

@ -513,7 +513,7 @@ function watchPages () {
r(this.srcDir, 'pages/**/*.vue'),
r(this.srcDir, 'layouts/*.vue'),
r(this.srcDir, 'layouts/**/*.vue')
].concat(this.options.build.watch)
]
const options = Object.assign({}, this.options.watchers.chokidar, {
ignoreInitial: true
})
@ -521,7 +521,11 @@ function watchPages () {
const refreshFiles = _.debounce(() => {
co(generateRoutesAndFiles.bind(this))
}, 200)
this.pagesFilesWatcher = chokidar.watch(_.uniq(patterns), options)
// Watch for internals
this.pagesFilesWatcher = chokidar.watch(patterns, options)
.on('add', refreshFiles)
.on('unlink', refreshFiles)
// Watch for custom provided files
this.customFilesWatcher = chokidar.watch(_.uniq(this.options.build.watch), options)
.on('change', refreshFiles)
}