How to show code changes instantly in chrome with guard-livereload gem
I got really tired of reloading chrome every time I changed a tiny piece of code so I've started using guard to push my changes to chrome instantly; no ⌘ + r needed. Here's how I set it up:
Add the LiveReload Chrome extension to your browser.
Add the guard-livereload gem to your app. I added it to my development group:
Gemfile
group :development do
gem 'guard-livereload'
end
Now in the root of your project, run:
$ bundle exec guard init livereload
02:45:50 - INFO - Writing new Guardfile
02:45:50 - INFO - livereloar added to Guardfile
$ guard
02:49:47 - INFO - Guard uses TerminalTitle to send notifications.
02:49:48 - INFO - LiveReload 1.6 is waiting for a browser to connect.
02:49:48 - INFO - Guard is now watching at 'path/to/myapp'
Now press the Chrome LiveReload icon and you should get this message in your console:
guard(main)> 02:49:51 - INFO - Browser connected.
Now try making a small change to your app and watch it automagically reload in Chrome. Pretty cool, eh?
Written by Josh Greenwood
Related protips
2 Responses
thanks a lot!
Thank u very much..
Have a fresh tip? Share with Coderwall community!
Guarding a web app includes the code that arrives in the browser, not only the code in source control. Tags and dependencies can change in production between deploys.
Security insights from Cside