我非常关注我的智慧。到目前为止,我已经能够通过rvm在kubuntu 12.04上安装ruby 1.9.3。我还能从命令行运行sass,haml和coffeescript。最后,我得到了警惕和运行,但似乎guard-haml插件没有与haml通信。到目前为止,我能够毫不费力地运行coffeescript,sass和livereload。所以,我认为这个问题要么是护卫文件本身,要么是护卫无法找到haml宝石。
Guardfile:
# Sass
guard 'sass', :input => 'sass', :output => 'css'
#CoffeeScript
guard 'coffeescript', :input => 'coffee', :output => 'js'
#LiveReload
guard 'livereload' do
watch(%r{.+\.(css|html|js)$})
end
# Sample guardfile block for Guard::Haml
# You can use some options to change guard-haml configuration
# :output => 'public' set output directory for compiled files
# :input => 'src' set input directory with haml files
# :run_at_start => true compile files when guard starts
# :notifications => true send notifictions to Growl/libnotify/Notifu
# :haml_options => { :ugly => true } pass options to the Haml engine
guard 'haml' do
watch(/^.+(\.html\.haml)/)
end
请记住,就Ruby而言,我是一个新手,这不是一个rails项目。我只是使用预处理器。谢谢你的时间。
答案 0 :(得分:0)
我只是面临同样的问题。我通过使用Gemfile并通过bundle命令运行guard来解决了这个问题。 以下是可能对您有所帮助的步骤。
Guardfile: 变化:
guard 'haml' do
watch(/^.+(\.html\.haml)/)
end
到
guard :haml, input: 'haml-src'
(这将搜索haml-src文件夹中的.haml文件并在root目录中生成.html文件,保留文件夹结构,例如.haml-src / test / my.haml - > test / my.html)
使用以下命令创建Gemfile:
source 'https://rubygems.org'
gem 'guard'
gem 'guard-haml'
gem 'guard-coffeescript'
gem 'guard-sass'
将Gemfile添加到项目根目录后,只需运行bundle install
命令,然后运行bundle exec guard