BrowserSync / gulp-browser-sync

How to use the Browsersync module with gulp.
http://browsersync.io
384 stars 27 forks source link

Gulp reload( { stream: true } ) Not Working on Yosemite 10.10.1 #42

Closed zlanich closed 9 years ago

zlanich commented 9 years ago

I'm unable to get the reload method to work in Gulp under any circumstances. Absolutely nothing happens when I call reload() no matter what configuration I use. There are no logged events when debugging log level is enabled either. I am however able to get it to work if I use BrowserSync to watch my compiled file directly and forgo using the reload method at all.

Below is my configuration:

var browserSync = require('browser-sync');
var reload = browserSync.reload;

gulp.task('browser-sync', function() {
  browserSync({
    proxy: "dev-local.mysite.com",
  });
});

gulp.task('bs-reload', function () {
  reload();
});

gulp.task('default', function() {
  gulp.run('compile-less');
});

gulp.task('compile-less', function() {

  var filesToCompile = [
    './less/site.less'
  ];

  gulp.src( filesToCompile )

    .pipe( plumber({ errorHandler: notify.onError("Error: <%= error.message %>") }) )

    .pipe( less({
      relativeUrls: true
    }) )

    .pipe( concat( 'style.compiled.css' ) )

    .pipe( gulp.dest('./css') )

    .pipe( reload( { stream: true } ) )

    .pipe( notify('Gulp Build Completed') );
});

gulp.task('watch', function() {
  gulp.watch( filesToWatch , ['default']);
});

If you have any input on why this may be, please help! Thanks!

shakyShane commented 9 years ago

Could your provide this as a small sample project highlighting the issue? It can just be a gulpfile.js, package.json, index.html file and a .less file.

This would help me debug the problem much fasrer

Keats commented 9 years ago

Hello, I just updated a project I hadn't used for a while and .reload doesn't inject the css on change. Here's the repo https://github.com/Keats/snowflake I'm on Archlinux

Keats commented 9 years ago

Nevermind, it works now somehow