简体   繁体   English

Ruby Guard Watch的运行速度非常慢

[英]Ruby Guard Watch is behaving really slow

Im using latest version of Guard and Guard-Haml. 我正在使用最新版的Guard和Guard-Haml。 I have 7 maps in my root dir where i store Haml files in two different directories. 我在根目录中有7个映射,在其中我将Haml文件存储在两个不同的目录中。 One is in /templates/haml and one is in /haml. 一个在/ templates / haml中,另一个在/ haml中。 The total sum of the haml files is less than 10. haml文件的总和小于10。

In the other 5 maps I have about 17 000 files. 在其他5张地图中,我大约有17000个文件。 I have configured guard to only watch in the /haml and /templates/haml maps for change. 我已将防护配置为仅在/ haml和/ templates / haml映射中进行更改。 It works fine just after I started with bundle exec guard , but after a while it gets slow as hell. 就在我开始使用bundle exec guard之后,它就可以正常工作,但是过了一会儿,它变得很慢。 About 30 seconds from where I make a change to a file does it take it to recompile the file. 从我对文件进行更改起,大约需要30秒才能重新编译该文件。

This is my Guardfile 这是我的Guardfile

require 'haml/helpers'
require 'haml/filters'
require 'haml/filters/php'

guard :haml, input: 'www/templates/haml', output: 'www/templates', :haml_options => { :escape_attrs => false } do
  watch %r{^www/templates/haml/.+(\.haml)$}
end

guard :haml, input: 'www/haml', output: 'www/', :haml_options => { :escape_attrs => false } do
  watch %r{^www/haml/.+(\.haml)$}
end

Is there anything I can do to speed this up because its really slowing my dev. 我有什么办法可以加快速度,因为它确实减慢了我的开发速度。 down. 下。

I found out that I could use the ignore command and ignore out all directories I didn't want guard to look at. 我发现我可以使用ignore command并忽略所有我不想让警卫查看的目录。 Example: 例:

ignore([%r{^node_modules/*}])

Link to more details about this 链接到有关此的更多详细信息

启动guard ,您只能观看这两个文件夹:

bundle exec guard --watchdir www/templates/haml www/haml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM