blob: 8ae70cf4088de24a462122a83e32eef2f874d149 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
'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 () {
this.server.on('close', done)
if (watchGlob && watchCall) watch(watchGlob, watchCall)
})
}
|