2013-08-18 1 views
1

.js 파일이 변경되면 (built.js 제외) requirejs 최적화 스크립트를 실행하고 싶습니다.Ruby Guard는 파일을 무시합니다.

무시 방법이 있습니다. 내 Gaurdfile (무한 루프의 원인이되는)에 다음과 같은 내용이 있습니다.

guard 'shell', :ignore => 'built.js' do 
    watch(/script\/(.*).js/) { `node r.js -o build.js` } 
end 

내 질문은 : 어떻게 Guardfile 파일 built.js을 무시하도록 구성해야합니까?

이미 가드 쉘 보석이 설치되어 가정 먼저

+1

built.js를 완전히 무시하고 싶다면 문서에서 볼 수있는 것처럼 파일 위쪽에 필터를 넣으십시오 (https://github.com/guard/guard/wiki/Guardfile). -examples. 필터 (.js 파일 만 고려)에 대한 자세한 내용은 https://github.com/guard/guard#filter의 설명서를 참조하십시오. guard-shell 구문에 대해서는 https://github.com/guard/guard-shell을 참조하십시오. – RobM

답변

6

은 ... 나는이 당신에게 당신이 뭘 하려는지 주어진에서 작업 할 무엇인가를 줄 생각합니다. 다른 .js 파일이 변경되면 script/build.js 파일을 무시하고 쉘 명령을 트리거합니다.

ignore /script\/build.js/ 

guard :shell do 
    watch /.*\.js/ do |m| 
    `yourcommandhere` 
    msg = "Processed #{m[0]}" 
    n msg, 'mycustomshellcommand' 
    "-> #{msg}" 
    end 
end 

See this link for Guardfile examples.
See this link for the syntax of guard-shell.