Live code reload for your Rails app

Hello, Let me share a wonderful gem that can bring support of live code reload for your Rails app:

Just add a gem and that’s all.

Check the demo: rails_live_reload

Look forward to seeing your comments and stars on GitHub :slight_smile:

3 Likes

you know, guard already does that pretty well

I know. But do you know the last real changes in the code happened 6 years ago? Or that it doesn’t support turbo, or requires lot’s of dependencies just based on gemspec file + I can imagine how those dependencies require another and so on. Plus it doesn’t know anything about Turbo.

And most important, have you actualy tried it? Because locally I get this:

Installing guard 2.18.0
ode .
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    current directory: /Users/admin/.rvm/gems/ruby-3.1.1/gems/eventmachine-1.2.7/ext
/Users/admin/.rvm/rubies/ruby-3.1.1/bin/ruby -I /Users/admin/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0

And finally,

It’s just not convenient and requires more effort.

2 Likes

This gem is really nice, @igorkasyanchuk! I’ve been using guard-livereload for a long time. But with rails_live_reload it seems I don’t have to install a plugin in the browser neither start a monitor process manually. These two points themselves are a compelling reason for me to migrate. I’ve also found that other of your gems can be quite useful to me, like the rails_charts. Thank you for sharing!

thank you @repoles such comments help to stay motivated and work on the opensource. By the way, there are more cool gems, full list is here https://www.railsjazz.com/ :slight_smile:

2 Likes

So far works for me. Guard live reload doesn’t work for us glr it doesn’t work over https, and we run https in dev. So this is fantastic! Thanks!

thank you for your feedback! Please share with your friends and put a star :slight_smile: or even make a contribution, since we have a bunch of todo’s

First, thanks for this. It seems to work great so far.

Second, it’s been a very long time since I’ve done any Rails development work so I am likely not recalling things well. I thought that Rails had hot code reloading straight out of the box. It appears that I’m wrong.

P.S. I might also be mis-interpreting this from the “Getting Started with Rails” guide:

In the development environment, Rails does not generally require you to restart the server; changes you make in files will be automatically picked up by the server.

But the way I read that, no special gems or additional configuration is needed to get auto-reloads.

Thanks (in advance) to anyone willing to cure my ignorance here!

P.P.S. I just realized that this line from the guide probably just means that the server need not be restarted for code changed to be picked up but that the browser will still need to be refreshed—which the gem listed above solves for. Still odd that this isn’t something Rails does out of the box. Seems like an obvious productivity enhancement.

yeap, you are right, Rails supports only code reload (on the next request), but not live code reload for CSS/ERB/etc