Last active
December 16, 2022 13:04
-
-
Save Steve-Reid/9e97127f6f5ab4c1e9f8cc65223ca97a to your computer and use it in GitHub Desktop.
Plop.js Generator Config files
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 characters
| export default function ( | |
| /** @type {import('plop').NodePlopAPI} */ | |
| plop | |
| ) { | |
| // create your generators here | |
| plop.setGenerator('component', { | |
| description: 'Create a component', | |
| prompts: [ | |
| { | |
| type: 'input', | |
| name: 'name', | |
| message: 'Components name:', | |
| }, | |
| ], | |
| actions: [ | |
| { | |
| type: 'add', | |
| path: 'src/components/{{pascalCase name}}/{{pascalCase name}}.tsx', | |
| templateFile: 'templates/component.template.hbs', | |
| }, | |
| { | |
| type: 'add', | |
| path: 'src/components/{{pascalCase name}}/index.tsx', | |
| templateFile: 'templates/index.template.hbs', | |
| }, | |
| ], | |
| }); | |
| plop.setGenerator('page', { | |
| description: 'Create a page', | |
| prompts: [ | |
| { | |
| type: 'input', | |
| name: 'name', | |
| message: 'Page name:', | |
| }, | |
| ], | |
| actions: [ | |
| { | |
| type: 'add', | |
| path: 'src/pages/{{pascalCase name}}/{{pascalCase name}}.tsx', | |
| templateFile: 'templates/component.template.hbs', | |
| }, | |
| ], | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment