glob-watcher
glob-watcher copied to clipboard
Watchers do not detect specific files
Taking this Gulp file:
const { watch } = require('gulp');
function css(cb) {
cb();
}
function js(cb) {
cb();
}
function defaultTask(cb) {
watch('src/**/*.css', css);
watch('src/scripts/index.js', js);
cb();
}
exports.default = defaultTask;
And, starting from an empty folder src, ...
- Run Gulp command.
- Create a CSS file. :white_check_mark: It is detected correctly (a "Starting 'css'..." and the appropriate finalization appear in the console).
- Change the content of this file. :white_check_mark: Detected.
- So, put the specific JS file. :x: Nothing happens.
- Change its content. :x: Nothing.
- Rerun command (finish and start again).
- Change the CSS content. :white_check_mark: Detected.
- Change the JS content. :white_check_mark: Detected.
Why this behaviour (steps 4 & 5)? Is it a bug, right?
This should be resolved in v5, but feel free to let me know if not and I'll reopen.
It makes the same. 😢
Seems like the issue is watching a specific file (not a glob) that doesn't exist yet, then when it does exist the change isn't being picked up.
I edited my issue explanation message to clarify more. Please, check it over.