-
Notifications
You must be signed in to change notification settings - Fork 186
Allow users to override scaffold generator templates #314
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
Conversation
b527209
to
fd7e0c4
Compare
Works great with scaffolds. |
@dixpac Yeah, I was hoping nobody would care about overriding those. 😆 😭 You're right, while I'm here I might as well add mailer and controller. Thanks for the review! |
and set Rails::Generators.templates_path to include it before the generator classes are instantiated so that the local 'lib/templates' directory is part of the generators' `source_paths`. Also see railties/lib/rails/generators/base.rb and `Rails::Generators::Base.inherited`
Note that developers can override by placing templates in either: - lib/templates/tailwindcss/{scaffold,mailer,controller} - lib/templates/erb/{scaffold,mailer,controller}
fd7e0c4
to
85c2c4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 😍
Originally reported at #164
I think this PR is preferable to #247 because it has tests and is a simpler fix.
Note that in order to test this, the test suite now uses the same temporary directory for all tests, so we are then able to set
Rails::Generators.templates_path
before the generator classes are instantiated.cc @dixpac