Commit 39efbaff authored by Dan Allen's avatar Dan Allen

further simplify the preview:serve task

- move watch function to third argument of previewServe function
parent aacad12d
'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({
......
'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()
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment