metalsmith-each
A Metalsmith plugin for easily applying a function to each file or filename.
This offers a simpler API than creating a full metalsmith plugin for the common case of iterating over each file individually and doing something to the file or filename.
Installation
$ npm install metalsmith-each
Usage
Just pass a function to metalsmith-each that accepts the metalsmith file object and, optionally, the filename.
var each = ; metalsmith;
To change the filename, just return a string with the new name.
var each = ; metalsmith;
Functions can be async, too. Just accept a done()
function as the third
argument. Note: If you accept the done function, you must call it or your build
will hang.
var each = ; metalsmith;
To rename a file with an async function, pass the new name to the done()
function.
var each = ; metalsmith;
License
MIT