2

Guard で CoffeeScript ファイルを JS ファイルにコンパイルしてから、Juicer でそれらをマージして縮小しようとしています。ディレクトリを使用してtmp、中間 JS ファイルを保存します。私が理解していることから、これは機能するはずですが、機能しません:

guard :coffeescript, :input => "src/coffee", :output => "tmp"

guard :shell do
    watch %r{^tmp/.+\.js$} do
        system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
    end
end

CoffeeScript ファイルは、アクセスされるtmpたびにディレクトリに正しくコンパイルされますが、shellガードは起動しません。

ガードを起動し--debug、JS ファイルの 1 つをtmp手動で変更すると、ターミナルにデバッグ行が表示されません。これらのファイルは監視されていないようです。

$ guard --debug
18:53:51 - DEBUG - Command execution: which notify-send
18:53:51 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
18:53:51 - INFO - Guard is using TerminalTitle to send notifications.
18:53:51 - DEBUG - Command execution: hash stty
18:53:51 - DEBUG - Guard starts all plugins
18:53:51 - DEBUG - Hook :start_begin executed for Guard::CoffeeScript
18:53:51 - DEBUG - Hook :start_end executed for Guard::CoffeeScript
18:53:51 - DEBUG - Hook :start_begin executed for Guard::Shell
18:53:51 - DEBUG - Hook :start_end executed for Guard::Shell
18:53:51 - INFO - Guard is now watching at '/home/tobia/my_project'
18:53:51 - DEBUG - Start interactor
[1] guard(main)> 

/home/tobia/my_project/tmp^^^この時点でJS ファイルを変更しても、何も起こりません。

私はDebian安定版のRuby 1.9.1、Guard 1.8.2、およびGuard-shell 0.5.1をインストールして使用していますsudo gem install

4

1 に答える 1

3

調査の結果、それtmpがデフォルトの無視リストに含まれていることがわかりました。これが、生成された JavaScript ファイルから Guard が変更を取得しない理由です。これを回避するには、次のいずれかを実行できます...

tmp1.無視されたディレクトリリストから削除します

ignore! /.git/

guard :coffeescript, :input => "src/coffee", :output => "tmp"

guard :shell do
  watch %r{^tmp/.+\.js$} do
    system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
  end
end

2. JavaScript を別のディレクトリにコンパイルします。

guard :coffeescript, :input => "src/coffee", :output => "src/js"

guard :shell do
  watch %r{^src/.+\.js$} do
    system 'juicer', 'merge', 'tmp/app.js', '-sfo', 'js/app.js'
  end
end
于 2013-08-29T11:24:59.897 に答える