0

I've successfully installed guard with haml and livereload plugins. In a running guard shell, when both are running, if I press enter, haml successfully gets compiled to html, then served up to a listening browser.

However, when only editing the haml file, and I save a change, livereload simply reloads the browser with the same generated .html. It does not recompile .haml -> .html, then serve it to the browser.

My Guardfile is below. What am I missing in this setup? i) In the guard shell, pressing enter compiles then serves the generated html. ii) But saving changes in the haml file only serves up old html, without compiling the haml.

guard 'haml', :input => 'public', :output => 'public' do
  watch(%r{^public/.+\.html\.haml})
end
guard 'livereload' do
  watch(%r{.+\.(css|js|html)})
end

Thanks

ps - this is not a rails project. just using the raw guard, guard-haml & guard-livereload gems

4

1 回答 1

1

在 Thibaud(“守卫”作者)的帮助下,我完成了这项工作。基本上,我在提供文件的目录下运行了警卫。

我的项目树看起来像“ root/public/css/etc ”,我在“ root ”下运行guard,并将“ public ”设置为要监视的目录(guard -w public/)。但我更新了 Guardfile 并将其移至 public/ ,并从那里运行了 Guardfile。现在,haml 正在根据需要进行编译和服务。

guard 'haml' do
watch(/^.+\.html\.haml$/)
end
guard 'livereload' do
  watch(/^.+\.html$/)
end
于 2011-09-28T22:39:09.803 回答