segmentio/metalsmith — pull request #73 by leeolayvar (2014-08-15 22:55:57+00:00)
Title: Ignore files support

**Note:** This is a very old commit i've been sitting on, so hopefully i didn't miss anything and this is no longer needed.

Currently Metalsmith reads all files in the given directory, and loads them into one massive dictionary in memory. With no way to ignore any of the files being loaded, you're sort of stuck watching your memory bloat or having Node simply crash.

`readdir()` supports an ignore param (https://github.com/jergason/recursive-readdir/pull/4) with Glob support on the way (https://github.com/jergason/recursive-readdir/pull/6). This PR adds support into metalsmith to ignore files, and not crash Node if the file list is too big.

A couple notes:

1. I added a tilde to the readdir dependency (`~1.1.2`) so that when the glob support is pushed to NPM, Metalsmith can make use of it.
2. I'm not sure if the ignores test inside of the `#use()` describe is really the best place for it. Suggestions welcome.

Usage:

```javascript
var m = Metalsmith()
m.ignore('foo');
m.ignore('bar/**/baz');
m.ignore(['boo', 'far', 'faz']);
```