Search code examples
rubyperformancehamlguard

Ruby Guard Watch is behaving really slow


Im using latest version of Guard and Guard-Haml. I have 7 maps in my root dir where i store Haml files in two different directories. One is in /templates/haml and one is in /haml. The total sum of the haml files is less than 10.

In the other 5 maps I have about 17 000 files. I have configured guard to only watch in the /haml and /templates/haml maps for change. It works fine just after I started with bundle exec guard, but after a while it gets slow as hell. About 30 seconds from where I make a change to a file does it take it to recompile the file.

This is my 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.


Solution

  • I found out that I could use the ignore command and ignore out all directories I didn't want guard to look at. Example:

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

    Link to more details about this