How can I make my gulp+livereload server automatically restart and update the page when JS files are changed?
Below is a snippet from my gulpfile.js:
var gulp = require('gulp'),
livereload = require('gulp-livereload'),
watch = require('gulp-watch'),
express = require('express'),
app = express(),
path = require('path'),
server = tinylr();
...
gulp.task('js', function() {
return gulp.src([
'app/scripts/*.js',
])
.pipe( concat('combined.js'))
.pipe( gulp.dest('../dist/app/js/'))
.pipe( livereload( server ));
});
gulp.task('watch', function () {
...
gulp.watch(['app/scripts/*.js'],['js']);
});