segmentio/metalsmith — pull request #46 by kfranqueiro (2014-04-27 01:46:29+00:00)
Title: Add support for cleanIgnore configuration

This adds support (and tests) for a `cleanIgnore` method/property, which can
receive a string or array of strings indicating names of files or
directories directly under the destination folder to _not_ clean.

This can be used e.g. for using metalsmith for gh-pages while
keeping both the source and build in the repository (akin to how
harp allows it by building from e.g. `./_harp` to `./`). For example:

```js
Metalsmith(__dirname)
.destination('.')
.cleanIgnore([
'src',
'node_modules',
'index.js',
'package.json',
'.git',
'.gitignore',
'.nojekyll'
])
// ...
.build();
```

Admittedly that list gets kind of long, but I didn't want to immediately go overboard into globbing or regexps or implicit defaults (like ignoring `.*`).