-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (30 loc) · 912 Bytes
/
gulpfile.js
File metadata and controls
38 lines (30 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* const gulp = require( 'gulp' );
const connect = require( 'gulp-connect' );
const files = [ 'index.html', 'm-script.js', 'm-script.css' ];
gulp.task( 'files', function() {
gulp.src( files ).pipe( connect.reload() );
});
gulp.task( 'watch', function(done) {
gulp.watch(files, ['files']);
done();
});
gulp.task( 'connect', function(done) {
connect.server({ livereload: true });
done();
});
gulp.task('default', gulp.parallel('connect','watch')) */
const { parallel, src, watch } = require('gulp')
const connect = require('gulp-connect')
function serveTask (done) {
connect.server({
root: 'src',
livereload: true,
port: 8000,
}, function () { this.server.on('close', done) })
}
function watchTask (done) {
watch('src').on('change', (filepath) =>
src(filepath, { read: false }).pipe(connect.reload()))
done()
}
module.exports.default = parallel(serveTask, watchTask)