Skip to content

Instantly share code, notes, and snippets.

@niallobrien
Created April 23, 2014 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niallobrien/11213836 to your computer and use it in GitHub Desktop.
Save niallobrien/11213836 to your computer and use it in GitHub Desktop.
gulp.task('watch', ['browser-sync', 'serve'], function () {
var browserSync = require('browser-sync');
// watch for changes
gulp.watch([
"app/*.html",
"app/styles/**/*.css",
"app/scripts/**/*.js",
"app/images/**/*"
]).on('change', function () {
browserSync.reload({stream:true});
});
gulp.watch('app/styles/**/*.scss', ['styles']);
gulp.watch('app/scripts/**/*.js', ['scripts']);
gulp.watch('app/images/**/*', ['images']);
gulp.watch('bower.json', ['wiredep']);
});
@shakyShane
Copy link

  1. Upgrade to BrowserSync 0.8.2
  2. move var browserSync = require('browser-sync'); at the top of your gulpfile
  3. replace browserSync.reload({stream:true}); with just browserSync.reload();
  4. don't watch css files with gulp, put .pipe(browserSync.reload({stream:true})) in your sass task.

@niallobrien
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment