Last active
October 16, 2017 06:29
-
-
Save doublejosh/30a19a85b324b3542a62ae21262a6967 to your computer and use it in GitHub Desktop.
Revisions
-
doublejosh revised this gist
Oct 16, 2017 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,14 +11,12 @@ */ /** * @param {object} options */ module.exports = function (options) { /** * Manipulate loaded src file data. * * @param {object} data * @param {object} options -
doublejosh created this gist
Oct 16, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ /** * @file Plugin template. * * @example * var myPlugin = require('./plugins/my-plugin'); * Metalsmith(__dirname) * .source('./src') * .destination('./build') * .use(myPlugin()) * .build(function(err) {}); */ /** * Publicly available module. * * @param {object} options */ module.exports = function (options) { /** * Manipulate loaded page data. * * @param {object} data * @param {object} options */ function myPlugin (data, options) { } /** * Operate on each file. * * @param {object} files * @param {Metalsmith} metalsmith * @param {function} done */ return function pluginFileWalk(files, metalsmith, done) { setImmediate(done); Object.keys(files).forEach(function(file) { myPlugin(files[file], options); }); }; };