Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write JavasScript project using guard-livereload?

I would like to start learn JS. I found gem guard-livereload.

In my Rails apps it works great. But I would like to use it to reload local files for simple JS scripts.

so I installed guard-livereload to rvm gemset global. Created new dir javascript added to Guardfile

# https://github.com/guard/guard-livereload
guard :livereload do
  watch(%r{.+\.(html|css|js)$})
end

opened Chrome with Livereload extension(1.6)

This is from my console:

> guard                                                                                                                                                                    /Users/rege/Code/javascript 1.9.3p194 @
Guard could not detect any of the supported notification libraries.
Guard is now watching at '/Users/rege/Code/javascript'
LiveReload 1.6 is waiting for a browser to connect.
Browser connected.
Browser URL: file://localhost/Users/rege/Code/javascript/examples/example_1_2.html
Reloading browser: examples/example_1_2.html
Reloading browser: examples/example_1_2.html
Reloading browser: examples/example_1_2.html

My Guard version:

> gem list guard                                                                                                                                                           /Users/rege/Code/javascript 1.9.3p194 @

*** LOCAL GEMS ***

guard (1.3.0)
guard-livereload (1.0.0)

All seems works but Chrome doesn`t refresh page.

like image 319
tomekfranek Avatar asked Feb 24 '26 23:02

tomekfranek


1 Answers

In Chrome you have to explicitly give extensions permissions to file urls. Right click on the LiveReload icon, go to manage extensions, and give LiveReload permissions to file urls.

like image 62
ShaunK Avatar answered Feb 27 '26 11:02

ShaunK