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

Simplify Install Task & Precompile Initializer #18

Closed
wants to merge 3 commits into from
Closed

Simplify Install Task & Precompile Initializer #18

wants to merge 3 commits into from

Conversation

Ancez
Copy link

@Ancez Ancez commented Apr 9, 2022

  • moved the if to be done inline so now instead of adding 3 lines, it adds 1 line to the layout

@Ancez Ancez changed the title Simplify Install Task Simplify Install Task & Precompile Initializer Apr 9, 2022
@Ancez
Copy link
Author

Ancez commented Apr 9, 2022

@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 🤔🤷‍♂️

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 )
Copy link
Owner

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.

Copy link
Author

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

@kirillplatonov
Copy link
Owner

@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 after_action in the controller that will modify output HTML and inject script tag automatically.

@@ -15,7 +15,7 @@ class Engine < ::Rails::Engine
#{root}/app/helpers
)

initializer "hotwire_livereload.assets" do
initializer 'hotwire_livereload.assets' do
Copy link
Author

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

@kirillplatonov
Copy link
Owner

@Ancez thanks for the work on this PR. I have to close it as another PR having similar changes has been merged: #22

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.

2 participants