-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Simplify Install Task & Precompile Initializer #18
Conversation
Ancez
commented
Apr 9, 2022
•
edited
Loading
edited
- moved the if to be done inline so now instead of adding 3 lines, it adds 1 line to the layout
@kirillplatonov let me know what you think of these changes 🙂 I hope you are well I also wonder whether we could somehow get the js include tag to not be required in the app layout as realistically we want it in all the layouts (my example being the devise layout) so we either should be looping over all the layouts and inserting it to all of these or somehow get this outside of the app layouts 🤔🤷♂️ |
lib/hotwire/livereload/engine.rb
Outdated
Rails.application.config.assets.precompile += %w( hotwire-livereload.js ) | ||
end | ||
initializer 'hotwire_livereload.assets.precompile' do |app| | ||
app.config.assets.precompile += %w( hotwire-livereload.js ) |
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.
I think we still need to check if config responds to assets
as the app might not use sprockets and use https://github.com/rails/propshaft instead.
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.
yep! Great call, I've updated the PR 🙌
this is something I've got to add to my gem too 😆 noticed it on one of the projects
@Ancez one-line installer looks good to me 🙂 As for alternatives for including a livereload tag in the layout - I'm not sure about that. We could probably add rack middleware or |
@@ -15,7 +15,7 @@ class Engine < ::Rails::Engine | |||
#{root}/app/helpers | |||
) | |||
|
|||
initializer "hotwire_livereload.assets" do | |||
initializer 'hotwire_livereload.assets' do |
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.
what're your thoughts on the usage of single quotes instead? I tend to stick to single quotes unless I need variables in the string