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 work (re-titled) #1

Closed
dashed opened this issue Jan 18, 2014 · 8 comments
Closed

globs beginning with ./ doesn't work (re-titled) #1

dashed opened this issue Jan 18, 2014 · 8 comments

Comments

@dashed
Copy link

dashed commented Jan 18, 2014

globs beginning with ./ doesn't work.

ORIGINAL TITLE: watch({glob: ... }) detects new folders but not new files
ORIGINAL POST:

I'm using watch({glob: 'src/**/*.md'}), and it doesn't seem to detect new .md files.

However, folders seem to be detected. I use gulp-ignore to filter them.

@floatdrop
Copy link
Owner

Could you try watch({glob: './src/**/*.md'})? - this is working for me.

@dashed
Copy link
Author

dashed commented Jan 19, 2014

Tried it. Still doesn't work.

I tried attaching a data handler to check if it's going through. Also, gulp-watch should output file changes.

When I rename a file, the delete event is captured.

@floatdrop
Copy link
Owner

I try'd this code:

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

And it neither picking up new files. I think this issue in gaze or in our understanding of glob parameter of gaze.

@dashed
Copy link
Author

dashed commented Jan 19, 2014

Hmm. You said it works on gaze 0.5?

@floatdrop
Copy link
Owner

Error with renaming directories is fixed in gaze 0.5 - yes.

@dashed
Copy link
Author

dashed commented Jan 19, 2014

Using your code, and changing path to 'src/**/*.md', makes it work.

Though the ready seems to refire.

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

And coincidentally, makes gulp-watch work normally.

So apparently, globs beginning with ./ does not work.

Since I store source directories as variables, I resorted to using path.join to normalize paths.

I suggest filtering globs through path.join to be safe -- though this should be addressed within gaze itself.

@dashed
Copy link
Author

dashed commented Jan 19, 2014

Also, I originally reported the issue with the path 'src/**/*.md' when, really, it was './src/**/*.md' in my gulpfile.js xD

@floatdrop
Copy link
Owner

I guess this is resolved then.

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

2 participants