2

我正在尝试guard-livereload在我的Codio盒子上运行。

问题是,当我“运行”项目时CONNECTION_REFUSED,我的浏览器控制台中出现错误。

我不确定这是做什么的,因为我已将端口更改为 Codio 范围并将文件设置为监视 PHP 文件:

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'livereload', :port => '4000' do
  watch(%r{.+\.(css|js|html|php)$})
end

我也在我的所有页面中包含了这个文件:

<script type="text/javascript" src="http://0.0.0.0:4000/livereload.js"></script>

当我运行guard它时,它正在等待浏览器连接。

4

1 回答 1

2

In codio box you have a domain name associated with your project: .codio.io, you can find it in IDE menu Project->Box Info. You should use it in your client code to include the livereload.js file. example (my bo domain is rebold-bogard):

<script type="text/javascript" src="http://rebold-bogard.codio.io:4000/livereload.js"></script>

0.0.0.0 address is for binding on server side. By default guard binds 0.0.0.0, this mean nothing to change here, only think you should be mind of is a notification library, you should use libnotify to track codio changes.

于 2014-11-19T07:48:17.740 回答