Yeah you can append code to existing file with append action. Something like this
{// Action type 'append' injects a template into an existing filetype:'append',path:'src/routes/index.js',// Pattern tells plop where in the file to inject the templatepattern:`/* PLOP_INJECT_IMPORT */`,template:`import {{pascalCase name}} from './{{pascalCase name}}';`,},
Great, and currently there is a package which is based on plop and preconfigured to create components in react, angular, vue and stencil. npmjs.com/package/plop-gen Create any component and you can rename it and you can choose where you want to create it. Good luck
this is great ! can we add import same route in router file also?
Yeah you can append code to existing file with
append
action. Something like thisbut also we need to create router :(
your linkedin? how can we connect
yeah, let's talk on twitter
Great! How can I add a dynamic path for files instead of the default src/components/?
Thank you!
You can change the path of the action to whatever you want, for example
or a dynamic value from the prompts
Great, and currently there is a package which is based on plop and preconfigured to create components in react, angular, vue and stencil. npmjs.com/package/plop-gen
Create any component and you can rename it and you can choose where you want to create it.
Good luck
Thanks
You're welcome!
Great article ivan.
Thanks Rohil!