Needed: livereload and sass. Code:

var gulp = require('gulp'), sass = require('gulp-sass'), livereload = require('gulp-livereload'); gulp.task('sass', function(){ gulp.src('./opencart.loc/**/*.scss') .pipe(sass()) .pipe(gulp.dest('./opencart.loc')) .pipe(livereload()); }); gulp.task('sass:watch', function(){ livereload.listen(); gulp.watch('./opencart.loc/**/*.scss', gulp.series('sass')); }); 

As a result, the task runs exactly once when saving the sass file. At this point, the console appears:

  C:\xampp\htdocs\opencart.loc\style.css reloaded. 

And everything, does not react to the subsequent edits. Where is the mistake? livereload version 4

  • gulp.watch('./opencart.loc', gulp.series('sass')); try it - Stranger in the Q
  • Without changes. Works before the first save. - Andrey

1 answer 1

Understood.

 var gulp = require('gulp'), sass = require('gulp-sass'), livereload = require('gulp-livereload'); function style(){ return gulp.src('./opencart.loc/**/*.scss') .pipe(sass()) .pipe(gulp.dest('./opencart.loc')) .pipe(livereload()); } function watch(){ livereload.listen(); gulp.watch('./opencart.loc/**/*.scss', style) } gulp.task(style, style); gulp.task(watch, watch);