1

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.

Philip
  • 6,827
  • 13
  • 75
  • 104

2 Answers2

7

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

Philip
  • 6,827
  • 13
  • 75
  • 104
2

You can only watch those two folders when you start guard:

bundle exec guard --watchdir www/templates/haml www/haml
Wenbing Li
  • 12,289
  • 1
  • 29
  • 41
  • the problem is that when I specify what dirs to watch I have problem with the watcher. – Philip Aug 08 '14 at 12:29
  • @Philip - try a newer version of Guard - I fixed the `watchdir` handling at some point (which returns wrong paths), so your `Guardfile` shouldn't need any changes (even if you use `--watchdir` on the commandline or `directories` in your `Guardfile`, all the paths will be relative to the path where you started Guard). – Cezary Baginski Dec 17 '14 at 09:11