Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Generators #914

Closed
cannikin opened this issue Jul 30, 2020 · 3 comments · Fixed by #3384
Closed

Custom Generators #914

cannikin opened this issue Jul 30, 2020 · 3 comments · Fixed by #3384

Comments

@cannikin
Copy link
Member

cannikin commented Jul 30, 2020

Let users override the default generator templates from their own code.

  • Add a command to copy existing generator to local codebase
  • Have generators look at the app's directory before defaulting back to package template

/cc @burnsy

@cannikin cannikin self-assigned this Jul 30, 2020
@BurnedChris
Copy link
Contributor

So after having a quick conversation with rob, about how I was feeling that I felt like I was going faster by using the generators but then I was slowed down because I needed to customize the generators to fit the layout, customized table css etc.

Then I remembered the concept in gatsby called shadowing.

How I think shadowing the generators could work;

  1. RW CLI command to duplicate the generator file locally (ie to web/generators/)
  2. When The RW CLI Generator command is run it will check to see if the is a customized generator file and if not then load the default redwood generator file

I think it could work quite well as the customization would truly allow you to speed up as the layout would completely match what you need them for without having too much customization.

Also, Could you want to have multiple frontend generator files? 1 for login 2 for dashboard etc.

@Tobbe
Copy link
Member

Tobbe commented Jul 31, 2020

It'd be cool if it was possible to yarn add community generators.

At work, for example, in our React app, for every page (FooPage.tsx) we have a sass-file (FooPage.scss). It'd be really useful to be able to write a generator package that when generating a new page also generated an empty sass file and added the corresponding import to *Page.tsx. This generator package would then be published to our org on npm and easily installed in all of our (hypothetical) RW projects.

@cannikin
Copy link
Member Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants