javascript - gulp watch doesn't watch -
following gulpfile.js. there couple of more tasks in , working fine - last task, watch doesn't.
i've tried every possible combination of paths , files , ever, still don't have luck. i've read many answers on here, couldn't solve problem. tried run gulp.watch , without requiring gulp-watch, tried several different approaches on how set task , on , on...
var gulp = require('gulp'); var browserify = require('browserify'); var babelify = require('babelify'); var source = require('vinyl-source-stream'); var watch = require('gulp-watch'); gulp.task('application', function() { return browserify('./public/resources/jsx/application.js') .transform(babelify, { stage: 0 }) .bundle() .on('error', function(e){ console.log(e.message); this.emit('end'); }) .pipe(source('appbundle.js')) .pipe(gulp.dest('./public/resources/jsx')); }); gulp.task('watch', function() { gulp.watch('./public/resources/jsx/project/*.js',['application']) }); can suggest solution?
edit:
here's console output:
michael@michael-desktop:/opt/phpstormprojects/app_april_2015$ gulp watch [23:05:03] using gulpfile /opt/phpstormprojects/app_april_2015/gulpfile.js [23:05:03] starting 'watch'... [23:05:03] finished 'watch' after 13 ms
you should return watch:
gulp.task('watch', function() { return gulp.watch('./public/resources/jsx/project/*.js',['application']) }); watch async method, way gulp can know happening if return promise, watch does.
edit
as @jmm stated, watch doesn't return promise. returns eventemitter.
Comments
Post a Comment