-
Notifications
You must be signed in to change notification settings - Fork 93
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
Generators and tasks do not work in engines #138
Comments
Feel free to explore a fix to this 👍 |
Small progress update here: Fixing the Stimulus controller generator seems trivial and I'll submit a pull request for that. However, more challenging is the getting Stimulus tasks to show up in the engine root without modifying the engine's Rakefile. Any tasks declared with Critically, there doesn't appear to be any way to add unscoped tasks within a Rails::Engine. I think the solution is making changes to Railties to have something like
In the case of Stimulus, we would want Thoughts? Should I pursue a more significant pull request on Railties to accomplish this @dhh ? |
That's a good question. I don't have the answer, but maybe @rafaelfranca does. |
I've made a pull request to address this. It's not tiny, but the more I got into it, the more related issues and edge-cases I found to fix and clean up. :) The one drawback is I had to include a small monkeypatch to Rake's DSL to allow creating unscoped top-level tasks. Incidentally, I discovered ActionCable also has a few similar issues with its generator that needs addressing. |
When using Stimulus in an engine, running the stimulus controller generator doesn't respect the engine namespace. So it'll generate in app/javascript/controllers instead of app/javascript/engine_name/controllers
Furthermore, the stimulus tasks are not available, so the automatic execution of stimulus:manifest:update by the generator fails.
I know this can all be done manually, but it's unintuitive that it doesn't work when other Rails generators operate correctly.
The text was updated successfully, but these errors were encountered: