gulp 3.8.11, gulp-live-server 0.0.20, node 0.10.25. I'm experiencing the following exception, which is raised at the first saving of a watched file:
> gulp serve
[17:33:19] Using gulpfile project/gulpfile.js
[17:33:19] Starting 'serve'...
[17:33:19] Finished 'serve' after 15 ms
livereload[tiny-lr] listening on 35729 ...
GET / 304 146.684 ms - -
GET /stylesheets/style.css 304 5.846 ms - -
project/node_modules/gulp-live-server/index.js:202
this.lr.changed({body: {files: [filepath]}});
^
TypeError: Cannot read property 'lr' of undefined
at exports.notify (project/node_modules/gulp-live-server/index.js:202:13)
at Gaze.<anonymous> (project/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/index.js:18:14)
at Gaze.EventEmitter.emit (events.js:98:17)
at Gaze.emit (project/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:129:32)
at project/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:415:16
at StatWatcher._pollers.(anonymous function) (project/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:326:7)
at StatWatcher.EventEmitter.emit (events.js:98:17)
at StatWatcher._handle.onchange (fs.js:1109:10)
gulpfile.js:
var gulp = require('gulp');
var gls = require('gulp-live-server');
gulp.task('serve', function() {
//1. run your script as a server
var server = gls.new('bin/www');
server.start();
// use gulp.watch to trigger server actions(notify, start or stop)
gulp.watch('views/**/*.jade', server.notify);
gulp.watch('public/**/*', server.notify);
// Event object won't pass down to gulp.watch's callback if there's more than one of them.
// So the correct way to use server.notify is as following:
// gulp.watch('public/stylesheets/**/*.less', function(event) {
// gulp.run('less');
// server.notify(event);
// });
gulp.watch(['.env', 'bin/www', 'app.js', 'routes/**/*.js'], function(event) {
server.start()
.then(function() {
return setTimeout(function() {
return server.notify(event);
}, 1000);
}).catch(function (error) {
throw error;
}).done();
}); //restart my server
});
gulp 3.8.11, gulp-live-server 0.0.20, node 0.10.25. I'm experiencing the following exception, which is raised at the first saving of a watched file:
gulpfile.js: