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

Comments

Projects
None yet
3 participants
@dashed

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

This comment has been minimized.

Show comment
Hide comment
@shama

shama Jan 19, 2014

Owner

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

Owner

shama commented Jan 19, 2014

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

@dashed

This comment has been minimized.

Show comment
Hide comment
@dashed

dashed Jan 19, 2014

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

It seems to be unexpected behaviour.

dashed commented Jan 19, 2014

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

It seems to be unexpected behaviour.

@shama

This comment has been minimized.

Show comment
Hide comment
@shama

shama Jan 19, 2014

Owner

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);
});
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

This comment has been minimized.

Show comment
Hide comment
@dashed

dashed 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 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

This comment has been minimized.

Show comment
Hide comment
@dashed

dashed commented Apr 10, 2014

Yay. :D

khaled added a commit to khaled/react-express-template that referenced this issue Aug 31, 2014

@jumplee

This comment has been minimized.

Show comment
Hide comment
@jumplee

jumplee Oct 22, 2014

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

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

This comment has been minimized.

Show comment
Hide comment
@dashed

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

Gulp Watch is super powerful now
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