summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gulpfile.js/index.js4
-rw-r--r--gulpfile.js/tasks/preview-serve.js10
2 files changed, 5 insertions, 9 deletions
diff --git a/gulpfile.js/index.js b/gulpfile.js/index.js
index d2f2396..c9f01b8 100644
--- a/gulpfile.js/index.js
+++ b/gulpfile.js/index.js
@@ -1,6 +1,6 @@
'use strict'
-const { parallel, series, tree } = require('gulp')
+const { parallel, series, tree, watch } = require('gulp')
const task = require('./lib/task')
const bundleName = 'ui'
@@ -84,7 +84,7 @@ const previewBuildTask = task({
const previewServeTask = task({
name: 'preview:serve',
- call: previewServe(previewDestDir, { port: 5252, livereload, watch: { glob: glob.all, call: previewBuildTask } }),
+ call: previewServe(previewDestDir, { port: 5252, livereload }, () => watch(glob.all, previewBuildTask)),
})
const previewTask = task({
diff --git a/gulpfile.js/tasks/preview-serve.js b/gulpfile.js/tasks/preview-serve.js
index 8ae70cf..c9a9c25 100644
--- a/gulpfile.js/tasks/preview-serve.js
+++ b/gulpfile.js/tasks/preview-serve.js
@@ -1,14 +1,10 @@
'use strict'
const connect = require('gulp-connect')
-const { watch } = require('gulp')
-module.exports = (serveDir, opts = {}) => (done) => {
- const { glob: watchGlob, call: watchCall } = opts.watch || {}
- opts = { ...opts, root: serveDir }
- delete opts.watch
- connect.server(opts, function () {
+module.exports = (serveDir, opts = {}, watch = undefined) => (done) => {
+ connect.server({ ...opts, root: serveDir }, function () {
this.server.on('close', done)
- if (watchGlob && watchCall) watch(watchGlob, watchCall)
+ if (watch) watch()
})
}