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

Remove application.js after bundle in template #3034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taylor-steve
Copy link
Contributor

@taylor-steve taylor-steve commented Jun 27, 2024

Fixes part of #3014. I believe the manifest.js issue is fixed, but unreleased, in blacklight-gallery so that would still require manually fixing that newline if testing this for real.

Moves the removal of app/javascript/application.js to the end of the end of the process. Steps that run after the install_generator, like stimulus-rails installing, recreate the file.

https://github.com/hotwired/stimulus-rails/blob/ae4b675473b71fdf01530c8a6a3bb277d3388ee2/lib/install/stimulus_with_importmap.rb#L11

@taylor-steve taylor-steve marked this pull request as ready for review June 27, 2024 23:18
@@ -21,9 +21,6 @@ def add_js_rails6
def add_manifest
append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
append_to_file 'app/assets/config/manifest.js', "\n//= link spotlight/manifest.js"

# Rails installed importmap by default, but we don't have importmap + Blacklight 7 working yet.
remove_file 'app/javascript/application.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need this even if we're not using the template? The use of template.rb is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was assuming that for fresh Rails apps it still wouldn't do much because stimulus-rails would install after. For existing apps, it seemed slightly questionable to delete their application.js (even if it results in Spotlight not working). I haven't tested those assumptions yet, so I'm happy to leave the generator untouched and work toward getting the template instructions working as written.

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

Successfully merging this pull request may close these issues.

None yet

2 participants