Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Fix for double gulp watching tasks #692

Merged
merged 1 commit into from
Nov 22, 2016
Merged

Fix for double gulp watching tasks #692

merged 1 commit into from
Nov 22, 2016

Conversation

desicochrane
Copy link
Contributor

@desicochrane desicochrane commented Nov 22, 2016

This PR fixes a bug whereby watching tasks of the same name with the same watching directory means they will be fired exponentially!

This is because during gulp watch when a matching watcher file pattern triggers its task, then each task will then proceed to run all tasks with the same name.

By indicating that a particular task is currently being "watched" and flagging whether elixir is in "watch mode" or not, this PR attempts to only fire the task being watched (and not all with the same name) when elixir is in watch mode.

Steps to reproduce the bug:

  1. create 2 new files: resources/assets/sass/a.scss and resources/assets/sass/b.scss both with the contents:
    @import "app";
  2. in your gulpfile:
    elixir((mix) => {
        mix.sass('a.scss')
           .sass('b.scss');
    });
  3. run gulp watch
  4. You should see no problem at this point ✅
  5. Make a change to resources/assets/sass/app.scss
  6. check the terminal, you should see gulp has done compiled a.scss and b.scss twice! 🐛

Steps to check this fixes it

  1. Repeat the above steps with this branch checked out
  2. Everything should now work as expected

@JeffreyWay
Copy link
Contributor

This looks like a pretty clean fix! Thanks so much. I'm going to test it out today.

@JeffreyWay JeffreyWay merged commit fdffe4a into laravel:master Nov 22, 2016
@JeffreyWay
Copy link
Contributor

Good PR and description of the problem. Thanks!

@desicochrane
Copy link
Contributor Author

Thanks Jeffrey!

@desicochrane desicochrane deleted the bug/prevent-watchers-firing-multiple-times branch November 22, 2016 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants