Skip to content

Instantly share code, notes, and snippets.

@nicoespeon
Last active March 23, 2016 23:48
Show Gist options
  • Select an option

  • Save nicoespeon/76f229641fd534e25407 to your computer and use it in GitHub Desktop.

Select an option

Save nicoespeon/76f229641fd534e25407 to your computer and use it in GitHub Desktop.
Blog - Plop — a micro-generator to ease your daily life - setGenerator
module.exports = ( plop ) => {
// We declare a new generator called "module"
plop.setGenerator( "module", {
// Succintly describes what generator does.
description: "Create a new module",
// Get inputs from the user.
// That's Inquirer.js doing the job behind the hood.
prompts: [
{
type: "input",
name: "name",
message: "What is your module name?"
}
],
// List of actions to take.
// Here we "add" new files from our templates.
actions: [
{
type: "add",
path: "app/modules/{{camelCase name}}.js",
templateFile: "plop-templates/module.js"
},
{
type: "add",
path: "app/tests/{{camelCase name}}.tests.js",
templateFile: "plop-templates/module.tests.js"
}
]
} );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment