I'm trying to set up a gulp browser build system for a .NET MVC application, everything works, except for a live reboot with browser synchronization whenever a change occurs. This is my first attempt, so I could do something simple wrong. Here is my gulpfile.js
var gulp = require('gulp'), uglify = require('gulp-uglify'), jshint = require('gulp-jshint'), watch = require('gulp-watch'), livereload = require('gulp-livereload'), browserSync = require('browser-sync'), concat = require('gulp-concat'); //minify js gulp.task('minifyJS', function () { gulp.src('Scripts/**/*.js') .pipe(concat('app.js')) .pipe(gulp.dest('Scripts')) }); gulp.task('minifyCSS', function () { gulp.src('Content/**/*.css') .pipe(concat('app.css')) .pipe(gulp.dest('Content')) }); //browsersync gulp.task('browserSync', function () { var files = [ 'Scripts/**/*.js', 'Content/**/*.css', 'Views/**/*.cshtml' ]; browserSync.init(files, { proxy: "http://localhost:55783/" }); }); //default task wraps the two gulp.task('default', ['minifyJS', 'minifyCSS', 'watch', 'browserSync']); //watch tasks gulp.task('watch', function () { var jsWatcher = gulp.watch('Scripts/**/*.js', ['minifyJS']); var cssWatcher = gulp.watch('Content/**/*.css', ['minifyCSS']); jsWatcher.on('change', function (event) { console.log('Event type: ' + event.type); // added, changed, or deleted console.log('Event path: ' + event.path); // The path of the modified file }); cssWatcher.on('change', function (event) { console.log('Event type: ' + event.type); // added, changed, or deleted console.log('Event path: ' + event.path); // The path of the modified file }); });
when I run gulp watch , it works just fine when the lines are written to the console, but just do not reload. Ive ruined quite a few blog posts to no avail, any ideas?
EDIT: Browser-Sync launches a site from a proxy server only when I change the CSS or JS file in the directories listed, gulp watches it, but Browser-Sync does not. I need to update manually