Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot create a property 'mark' on string

I am new to Gulp. I have two tasks:

gulp.task('jadehtml', function() {
  var YOUR_LOCALS = {};
  gulp.src('source/jade/*.jade')
    .pipe(jade({
      locals: YOUR_LOCALS,
      pretty: true
    }))
    .pipe(gulp.dest('build'))
});
// End Gulp Jade 

// default task

//  sass
gulp.task('sass', function () {
  return gulp.src('source/scss/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('build/css'));
});

Now they work perfectly fine when run individually. But when I use the gulp.watch() command they give me an error. Here is my watch task:

gulp.task('watch', function() {
  gulp.watch('source/jade/*.jade', 'jadehtml');
  gulp.watch('source/scss/*.scss', 'sass');
});

This is the error:

Error for Gulp

like image 693
Marc Andre Jiacarrini Avatar asked Sep 05 '16 02:09

Marc Andre Jiacarrini


1 Answers

The tasks parameter that you pass to gulp.watch() always has to be an array, even if it's just one task. So instead of this:

gulp.watch('source/jade/*.jade', 'jadehtml');
gulp.watch('source/scss/*.scss', 'sass');

You need to do this:

gulp.watch('source/jade/*.jade', ['jadehtml']);
gulp.watch('source/scss/*.scss', ['sass']);
like image 61
Sven Schoenung Avatar answered Oct 19 '22 00:10

Sven Schoenung