3

JS를 배우고 싶습니다. gem guard-livereload가 발견되었습니다.guard-livereload를 사용하여 JavasScript 프로젝트를 작성하는 방법은 무엇입니까?

내 Rails 앱에서는 훌륭하게 작동합니다. 하지만 간단한 JS 스크립트를 위해 로컬 파일을 다시로드하는 데이 파일을 사용하고 싶습니다.

그래서 rvm gemset global에 guard-livereload을 설치했습니다.

> 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 

내 가드 버전 :

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

*** LOCAL GEMS *** 

guard (1.3.0) 
guard-livereload (1.0.0) 
만든 새로운 디렉토리 javascript

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

이 Livereload 확장이 내 콘솔에서이다 (1.6)

와 크롬을 열어 Guardfile에 추가

모두 보이는 것 같습니다. Chrome은 페이지를 새로 고침하지 않습니다.

+0

나를 위해 작동하지 않습니다. 자바 스크립트에서도 작동하는 Firefox 용 애드온을 찾았습니다. http://stackoverflow.com/questions/8710613/livereload-not-working-guard-firefox – zigomir

+0

livereload를 사용하는 데 도움이되는 질문에 감사드립니다. (나는'guard 명령을 실행해야한다는 것을 몰랐다.) – mik01aj

답변

2

Chrome에서 파일 URL에 확장 권한을 명시 적으로 부여해야합니다. LiveReload 아이콘을 마우스 오른쪽 버튼으로 클릭하고 확장 프로그램을 관리하며 LiveReload 권한을 파일 URL에 제공합니다.