Developing Web Apps with Rails is fun, but having to refresh the browser every time we make a change to our html or markup can be a pain. Luckily the guard-livereload gem exists and the configuration is quite straightforward, so if you're running Rails versions 5.4 to 6.0.0.1, this guide is for you.
Add gems to development
group :development do
gem 'guard-livereload', '~> 2.5', require: false
gem 'rack-livereload'
endbundle install
Tell Guard to setup your guard file for livereload guard init livereload
Then add the middleware to the bottom of your Rails middleware stack by editing your config/environments/development.rb.
MyApp::Application.configure do
config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload
endRun livereload from terminal bundle exec guard -P livereload
Now while running, every time guard detects a file change, rails will automatically refresh the browser so you can see your changes on every save.