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

Using gulp.src to match all subdirectories of a given directory, excluding given directory #306

Closed
hugoduraes opened this issue Feb 25, 2014 · 2 comments

Comments

@hugoduraes
Copy link

I'm trying to match all subdirectories of a given directory.

I want to match all .js files inside subdirectories:

/path/to/dir/dir1/*.js
/path/to/dir/dir2/dir3/*.js
/path/to/dir/dir4/*.js

While excluding:

/path/to/dir/

I'm using the following pattern:

/path/to/dir/**/*.js

When I run the gulp task, I get the following error:

Unable to find local gulp. Try running 'npm install gulp' /path/to/dir/.

Shouldn't /path/to/dir/ be excluded by the given pattern? Why is it looking for gulp on a directory that I don't want to be matched?

Thanks in advance!

@callumlocke
Copy link
Contributor

path/to/dir/**/*.js does include path/to/dir/*.js, because **/ means "zero or more directories".

I'm not sure if that's anything to do with your problem though, because it sounds like gulp isn't even starting... That message means the global gulp CLI ran, but it couldn't find a local copy of gulp in your current project. Make sure you're in the root of your project (where your gulpfile is), and then run gulp. And if you still get "Unable to find local gulp", then install it locally with npm install gulp --save.

@yocontra
Copy link
Member

You need to follow the instructions here https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

For future reference questions like this belong on StackOverflow.

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