Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Globs beginning with ./ doesn't capture file events #66

Closed
dashed opened this issue Jan 19, 2014 · 7 comments
Closed

Globs beginning with ./ doesn't capture file events #66

dashed opened this issue Jan 19, 2014 · 7 comments

Comments

@dashed
Copy link

dashed commented Jan 19, 2014

Following from this issue: floatdrop/gulp-watch#1

The following doesn't capture file events:

var Gaze = require('gaze').Gaze;
var gaze = new Gaze('./src/**/*.md');
// Files have all started watching
gaze.on('ready', function(watcher) {
    console.log('ready')
});
// A file has been added/changed/deleted has occurred
gaze.on('all', function(event, filepath) {
    console.log(event, filepath);
});

Removing ./ seems to work as normal.

I workaround it by filtering the glob target via path.join.

@shama
Copy link
Owner

shama commented Jan 19, 2014

Is prepending ./ necessary? The current working directory is always assumed with glob patterns.

@dashed
Copy link
Author

dashed commented Jan 19, 2014

Not really necessary, but I do it out of habit.

It seems to be unexpected behaviour.

@shama
Copy link
Owner

shama commented Jan 19, 2014

I guess we could strip ./ off patterns but I'm curious to know the root cause of the issue.

FWIW, this appears to not be an issue with the next version of gaze, v0.5. Using a slightly modified version of your example locally here:

var fs = require('fs')
var Gaze = require('./').Gaze;
var gaze = new Gaze('./tmp/*.js');
// Files have all started watching
gaze.on('ready', function(watcher) {
    console.log('ready')
    fs.writeFileSync('./tmp/1.js', 'testing')
});
// A file has been added/changed/deleted has occurred
gaze.on('all', function(event, filepath) {
    console.log(event, filepath);
});

@dashed
Copy link
Author

dashed commented Jan 19, 2014

It's not really a big deal. Though, I'll be looking forward to v0.5 since it seems to fix an issue or two with gulp-watch.

@dashed
Copy link
Author

dashed commented Apr 10, 2014

Yay. :D

@jumplee
Copy link

jumplee commented Oct 22, 2014

I use the npm to install the gulp-watch,and have the same problem.Have gulp-watch updated for the npm?

@dashed
Copy link
Author

dashed commented Oct 22, 2014

@jumplee Please make an issue about it at https://github.com/floatdrop/gulp-watch/issues

g5codyswartz added a commit to g5codyswartz/LikeAG5 that referenced this issue Feb 1, 2017
I had to change the diretories to not do absolute referenced pathing. Otherwise it wasn't triggering on new or removed files.
Bug here: shama/gaze#66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants