Custom template where user decide files and content
Is your feature request related to a problem? Please describe. Would be amazing if we could configure the output .
For many projects the components style is different , what if you could add custom generating functions and save them?
example in terminal , npx g-r-c Footer tailwind ,
then it create a folder “Footer” with a tsx, index, test and story file. No questions , no extra parameters . Only thing i did was i made a tailwind template to include these files and a specific content in them. It might take 4-5 extra minutes but when you have 30-50 components in a new project this would be such a time saver !
If I'm understanding you correctly, you could generate a template and then use that template via the Custom component templates to generate your real components? (If you want it in a different directory, you could even change the path to your preferred directory, like "." for your project root.)
I might have missed it in the documentation, but is there any way to generate .md files along with the other files in the option already?
Hi @stephyswe, based on your request, it sounds like you need custom component templates. Thankfully you're in luck because GRC already supports this feature. You can read more @ custom-component-templates. Let me know if you have any other questions. Thanks.
Hey @mrboen94, You can generate .md files with GRC. You just need to use custom-component-templates as well.
Step 1 Create your custom markdown template (e.g. path of the custom markdown template: grc/templates/TemplateName.md):
# markdown template
Step 2 Update your GRC config file (generate-react-cli.json) that points to your new custom markdown template:
{
"usesTypeScript": false,
"usesCssModule": true,
"cssPreprocessor": "css",
"testLibrary": "Testing Library",
"component": {
"default": {
"customTemplates": {
"markdown": "grc/templates/TemplateName.md"
},
"path": "src/components",
"withStyle": true,
"withTest": true,
"withStory": false,
"withLazy": false,
"withMarkdown": true
}
}
}
Step 3 Run your command:
npx generate-react-cli c Box
and you should see a Box.md file generated alongside your other component files.
I hope this is helpful. Let me know if you have other questions. Thanks.