Search code examples
phprubyguardlivereload

guard-livereload not reload browser


I am using guard-livereload gem to monitor changes in a PHP project. This is a gist to describe my guard config:

#setup the Gemfile
$ nano Gemfile
source 'https://rubygems.org'
group :development do
  gem 'guard'
  gem 'guard-livereload', require: false
end

$ bundle

#config the Guardfile
$ nano Guardfile
guard :livereload do
  watch(%r{.+\.(css|js|html|php|tpl)$})
end

When I run guard it works same but the browser don't reload the page.

$ bundle exec guard
18:37:36 - INFO - Guard is using NotifySend to send notifications.
18:37:36 - INFO - Guard is using TerminalTitle to send notifications.
18:37:36 - INFO - LiveReload is waiting for a browser to connect.
18:37:36 - INFO - Guard is now watching at '/var/www/html/se/se/application/modules/Tmp'
[1] guard(main)> 18:37:43 - INFO - Browser connected.
18:37:54 - INFO - Reloading browser: views/scripts/tmp/index.tpl
18:38:02 - INFO - Reloading browser: views/scripts/tmp/index.tpl
18:38:12 - INFO - Reloading browser: views/scripts/tmp/index.tpl
18:38:23 - INFO - Reloading browser: views/scripts/tmp/index.tpl
[1] guard(main)> 

Any ideas?


Solution

  • The reloading seems to be triggered properly, your problem is likely on the browser side. You need to

    • Install the browser extension
    • Run bundle exec guard in your shell
    • Navigate to your app in the browser
    • Activate Live Reload by clicking on its icon

    Live Reload Icon