[10:12:09] Using gulpfile ~/somelocalpath/gulpfile.js
[10:12:09] Starting 'watch'...
[10:12:09] Starting server...
[10:12:09] Finished 'watch' after 21 ms
[10:12:09] Server started http://localhost:8888
[10:12:09] LiveReload started on port 35729
[10:12:09] Running server
[10:12:47] Starting 'reload'...
[10:12:47] Finished 'reload' after 13 ms
[10:13:43] Starting 'reload'...
[10:13:43] Finished 'reload' after 1.75 ms
下面是gulp.js文件:
"use strict";
const gulp = require("gulp");
const connect = require("gulp-connect");
gulp.task("watch", function() {
connect.server({
root: "somelocalfolder",
livereload: true,
port: 8888
});
gulp.watch("./somelocalfolder/**/*", ["reload"]);
});
gulp.task("reload", function() {
return gulp.src("./somelocalfolder/**/*").pipe(connect.reload());
});