0
gulp.task('css', function () {
    gulp.src('custom_css/sass/style.scss')
        .pipe(sass({
            style: 'compressed'
        }))
        .pipe(gulp.dest('./public/css/'));
});

gulp.task('watch', function() {
  gulp.watch('custom_css/sass/style.scss', ['css']);
});

gulp.task('default', ['css','watch']);

this is my gulp script code. when I run gulp in the terminal it start watching for changes, auto compile sass file, but it stop watching if I closed the terminal window. I have also used gulp & to run it in background but not working so what is the proper way to auto compile it every time when I am make chages in the saas file.

HKumar
  • 1,535
  • 3
  • 13
  • 28

2 Answers2

2

I have make it run in the background with nohup gulp & and it's working perfectly. Is it right way to do it?

HKumar
  • 1,535
  • 3
  • 13
  • 28
0

Not not sure why you would want to run gulp forever. It is not meant to be used that way. However, check out forever.js.

dman
  • 10,406
  • 18
  • 102
  • 201
  • I want to run gulp because without it I have to run gulp every time after making changes in my sass file in order to compile it. – HKumar Nov 07 '15 at 07:38