Skip to content

Instantly share code, notes, and snippets.

@amaankulshreshtha
Last active August 20, 2022 06:24
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amaankulshreshtha/a0caff1fd694017af2698b6f688b965a to your computer and use it in GitHub Desktop.
PlopFile Setup
module.exports = function (plop) {
/** @type {import('plop').NodePlopAPI} */
plop.setGenerator('common', {
description: 'add a common component',
prompts: [{
type: 'input',
name: 'name',
message: 'common component name please'
}],
actions: [
{
type: 'add',
path: 'common/{{pascalCase name}}/index.js',
templateFile: 'plop-templates/ReactComponents/index.hbs'
},
{
type: 'add',
path: 'common/{{pascalCase name}}/index.styles.js',
templateFile: 'plop-templates/ReactComponents/index.styles.hbs'
},
]
});
plop.setGenerator('components', {
description: 'add a smart component',
prompts: [{
type: 'input',
name: 'name',
message: 'smart component name please'
}],
actions: [
{
type: 'add',
path: 'components/{{pascalCase name}}/index.js',
templateFile: 'plop-templates/ReactComponents/index.hbs'
},
{
type: 'add',
path: 'components/{{pascalCase name}}/index.styles.js',
templateFile: 'plop-templates/ReactComponents/index.styles.hbs'
},
]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment