如何让 Guard 自动编译我的 Coffeescript 文件?说是,但不是

How do I get Guard to automatically compile my Coffeescript file? Says it is but it's not

本文关键字:说是 文件 Coffeescript 我的 Guard 编译      更新时间:2023-09-26

我有以下保护文件

coffeescript_options = {
 input: 'src/js',
 output: 'www/js',
 patterns: [%r{^src/js/(.+'.(?:coffee|coffee'.md|litcoffee|js))$}]
}
guard 'coffeescript', :input => 'src/js', :output => 'www/js' do
  coffeescript_options[:patterns].each { |pattern| watch(pattern) }
end
# guard 'coffeescript', :input => 'src/js', :output => 'www/js'

我保存了src/js/tf.coffee文件并记录了这个

02:46:50 - INFO - Compile src/js/tf.coffee
02:46:50 - INFO - 02:46:50 AM Successfully generated
←]2;[CoffeeScript results] Successfully generated

但是,我在任何地方都找不到该文件。

$ find . -name tf.js
$ ls www/js
app.js

它适用于 HAML。这是一个Ruby应用程序,而不是Rails。(实际上是PhoneGap。我尝试了 Guardfile 中的注释行,但它无法识别对文件的更改。我使用的是Windows 8.1。我安装了节点 v5.4.0。我可以运行coffee -o www/js src/js/tf.coffee,它会生成 JS 文件。

文档:https://github.com/netzpirat/guard-coffeescript

糟糕,我不得不将guard行更改为

guard 'coffeescript', coffeescript_options do

我更改了它以尝试简化它,但忘记将其更改回来。仍然不确定为什么注释掉的行不起作用。