Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gulp.watch calls wrong task/callback #776

Closed
fregante opened this issue Nov 17, 2014 · 8 comments
Closed

gulp.watch calls wrong task/callback #776

fregante opened this issue Nov 17, 2014 · 8 comments

Comments

@fregante
Copy link

screen shot 2014-11-17 at 11 39 33

What happens:

  1. scss file changed: ok
  2. jade file changed: ok
  3. scss file changed: ok but jade's callback was called too
var gulp  = require('gulp');

gulp.task('scss', function () {
    return gulp.src('./styles/*.scss');
});
gulp.task('jade', function () {
    return gulp.src('./htdocs/*.jade');
});
gulp.task('default', function() {
  gulp.watch('./styles/*.scss', ['scss']);
  gulp.watch('./htdocs/*.jade', ['jade', function () {
    console.log('html was built');
  }]);
});

This is BrowserSync's suggested way to reload certain files, so others are likely having this issue too (browsersync is not in the test because it does not create the issue)

DOWNLOAD: Gulpfile, package.json, one jade and one scss files: http://cl.ly/YYAX

@heikki
Copy link
Contributor

heikki commented Nov 17, 2014

I can see the same issue with test package.

However, gulp.watch docs don't show combination of tasks and callback. There's only an array of task names OR callback. Is the BrowserSync example wrong or is there something missing from the docs?

@fregante
Copy link
Author

Maybe @shakyShane can shed some light on it? Here's the original issue that introduced that method: BrowserSync/browser-sync#134 (comment)

@heikki
Copy link
Contributor

heikki commented Nov 17, 2014

Orchestrator seems to handle callbacks that way. Once callback is added it is never removed.
https://github.com/orchestrator/orchestrator/blob/993535b1ba6721e7d5824742df2b22f6492c6c71/index.js#L150

@heikki
Copy link
Contributor

heikki commented Nov 17, 2014

This isn't problem in 4.0 branch. You can test it by running:

npm install "gulpjs/gulp#4.0" --save-dev
./node_modules/.bin/gulp

@fregante
Copy link
Author

Good to hear! How close is v4 to be stable?

@heikki
Copy link
Contributor

heikki commented Nov 17, 2014

Gulp 4 milestone has 9 open issues: https://github.com/gulpjs/gulp/milestones/gulp%204

@yocontra
Copy link
Member

You can use the 4.0 branch right now, just put the repo url in your package.json

@phated
Copy link
Member

phated commented Nov 19, 2014

This isn't something that will be solved in orchestrator before gulp4 is released, and as was stated by @heikki, the problem doesn't exist in 4.0. Feel free to switch to the 4.0 branch as it is stable and we are trying to get people to beta test so we can push forward on release. Closing this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants