0

I'm pretty new to gulp, here's what's happening

I did have:

gulp.watch(config.build.sass + '/**/*.scss', ['sass-dev']);

But this didn't catch any new files, so after reading the docs I need to have:

gulp.watch({
    glob: config.build.sass + '/**/*.scss',
    emit: 'all'
}, ['sass-dev']);

But this throws an error: Object #<Object> has no method 'indexOf' as the last part is incorrect.

Can anyone tell me the syntax I need to run my sass-dev task on anything emitted from watch?

designermonkey
  • 1,078
  • 2
  • 16
  • 28

2 Answers2

0

Have you tried this:

gulp.watch(config.build.sass + '/**/*.scss', {emit: 'all'}, ['sass-dev']);

?

Ben
  • 10,056
  • 5
  • 41
  • 42
  • Thanks for your answer. The problem there is that it doesn't pick up on any new files in the directory. The docs state that I need to use glob to watch the directory for new files, and existing. It then doesn't explain how to pass on to existing gulp tasks. – designermonkey Aug 06 '14 at 08:27
  • Which docs are you looking at? I don't see any mention of a `glob` option in the [gulp api docs](https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpwatchglob--opts-tasks-or-gulpwatchglob--opts-cb). Only a `glob` argument. – Ben Aug 06 '14 at 16:51
  • https://www.npmjs.org/package/gulp-watch Is this not the right gulp watch docset? – designermonkey Aug 07 '14 at 13:20
0

Your first example seems fine. No need to use glob option. But it depends on what config.build.sass is.

gulp.watch(config.build.sass + '/**/*.scss', ['sass-dev']);

If you'd like to use glob option, try this.

gulp.watch(config.build.sass + '/**/*.scss', { some_option: value }, ['sass-dev']);
Tsutomu Kawamura
  • 1,101
  • 9
  • 10