【问题标题】:How do I get Guard to automatically compile my Coffeescript file? Says it is but it's not如何让 Guard 自动编译我的 Coffeescript 文件?说是但不是
【发布时间】:2016-04-20 19:11:21
【问题描述】:

我有以下 Guardfile

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 上。我安装了 Node v5.4.0。我可以运行coffee -o www/js src/js/tf.coffee,它会生成JS文件。

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

【问题讨论】:

    标签: javascript ruby node.js coffeescript guard


    【解决方案1】:

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

    guard 'coffeescript', coffeescript_options do
    

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

    【讨论】:

    猜你喜欢
    • 2012-03-24
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    • 1970-01-01
    • 1970-01-01
    • 2019-12-24
    • 2020-07-20
    相关资源
    最近更新 更多