Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.03 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.03 KB

Glob expander

Expand your globs into an equivalent list of directories.

This was primarily created to work around the gaze issue that prevents files being added in subdirectories from being picked up as part of the watch process.

Note that this does not attempt to expand more complex minimatch patterns, like those including brackets or negations; instead, it returns the original pattern as part of the result.

Installs via npm:

npm install glob-expander

Example

Given the following directory structure:


gulpfile.js
public/
 js/
   app/
	   foo.js
   test/
     bar.js
server/
  routes/
		r1.js
		r2.js

In gulpfile.js:

var expandGlob = require('glob-expander');

// Expand a single glob
expandGlob('public/**/*.js'); // ['public/js/*.js', 'public/js/app/*.js', 'public/js/test/*.js'] 

// Expand multiple globs 
expandGlob(['public/**/*.js', 'server/**']); 
// ['public/js/*.js', 'public/js/app/*.js', 'public/js/test/*.js', 'server/*', 'server/routes/*']