Skip to content

Instantly share code, notes, and snippets.

@hoosteeno
Created April 27, 2016 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoosteeno/a823e6b1a50813619b00166ce63ca6a8 to your computer and use it in GitHub Desktop.
Save hoosteeno/a823e6b1a50813619b00166ce63ca6a8 to your computer and use it in GitHub Desktop.
metalsmith-devonly plugin
const devonly = function(plugin, options) {
if (process.argv.length > 2 && process.argv.indexOf('dev') > 0) {
return plugin(options);
}
else {
return function(files, metalsmith, done) {
done();
};
}
};
@hoosteeno
Copy link
Author

hoosteeno commented Apr 27, 2016

Add it to build.js:

.use(devonly(plugin, {
    option: value,
}))

@hoosteeno
Copy link
Author

Run it:
$ node build [dev]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment