Livereload does not update my browser when css files change using gulp

Therefore, I use gulp.js to manage and automate some tasks, and I have a specific task stylesthat compiles my scss files into css, and another one to start the server using the gulp-connect plugin that provides integration with the download line.

I also have the task of watchobserving my changes and starting the download from the keyboard.

gulp.task('watch', function () {
  gulp.watch([ stylesPath + '/**/*.scss'], ['styles']);
  gulp.watch([ scriptsPath + '/**/*.coffee'], ['scripts']);
  gulp.watch([
    './app/**/*.html',
    './app/assets/scripts/**/*.js',
    './app/assets/styles/**/*.css'
  ], connect.reload);
});

This does not always work, in fact it works less time than more. I really don't know why. I have the same logic with my .coffee files and it works great for them, but not for my css files.

The following are other related tasks.

gulp.task('connect', connect.server({
  root: './app',
  port: 1337,
  livereload: true,
  open: {
    file: 'index.html',
    browser: 'Google Chrome'
  }
}));

gulp.task('styles', function () {
  gulp.src('.sass-cache').pipe(clean({read:false}));
  return gulp.src(stylesPath + '/**/*.scss')
  .pipe(sass())
  .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
  .pipe(gulp.dest(stylesPath));
});
+3
2

.

html , - .

+3

, .

, Gulp github. - . https://github.com/gulpjs/gulp

+2

All Articles