plumber-glob
Version:
File globbing operation for Plumber pipelines
54 lines (30 loc) • 1.36 kB
Markdown
plumber-glob [](https://travis-ci.org/plumberjs/plumber-glob)
============
File globbing operation for [Plumber](https://github.com/plumberjs/plumber) pipelines.
## Example
var glob = require('plumber-glob');
module.exports = function(pipelines) {
pipelines['compile'] = [
glob('src/**/*.js'),
// ... more pipeline operations
];
};
## API
### `glob(patterns...)` or `glob.pattern(patterns...)`
Returns resources for all files matched by the list of patterns.
Patterns may include wildcards like `*` or `**` (globstar).
See the [minimatch](https://github.com/isaacs/minimatch) documentation for the full available syntax.
Example:
var allHtml = glob('**/*.html'); // or glob.pattern('**/*.html')
### `glob.exclude(patterns...)`
Returns a new `glob` function that excludes files patched by the patterns.
Example:
var globUnlessMinimised = glob.exclude('**/*.min.js');
var js = globUnlessMinimised("src/**/*.js");
### `glob.within(directory)`
Returns a new `glob` function scoped within the given directory.
Example:
var sources = glob.within('src');
var htmlAndCss = sources("index.html", "styles/*.css");
var scripts = sources.within('scripts');
var js = sources("**/*.js");