gulp4.0以上
var gulp = require('gulp');
var connect = require('gulp-connect');
gulp.task('html', function(done) {
gulp.src('index.html')
.pipe(connect.reload());
done()
});
gulp.task('connect', function() {
connect.server({
port: 2333,
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch('index.html', gulp.series('html'));
});
gulp.task('default', gulp.series(gulp.parallel('connect', 'watch')));