I would like Guard to send the output of a haml compilation to two different places. I tried calling haml in my Guardfile twice, like this:
guard 'haml', :output => 'first_dir/', :input => 'src/haml' do
watch %r{^src/haml/.+(\.html\.haml)(?!(\.swp))}
end
guard 'haml', :output => 'second_dir/', :input => 'src/haml' do
watch %r{^src/haml/.+(\.html\.haml)(?!(\.swp))}
end
But that just goes into an endless loop. What does my Guardfile need to look like to output to two different directories?
I don't see any problems with your Guardfile. As workaround you could use groups and start two Guard processes:
group :first do
guard 'haml', :output => 'first_dir/', :input => 'src/haml' do
watch %r{^src/haml/.+(\.html\.haml)(?!(\.swp))}
end
end
group :second do
guard 'haml', :output => 'second_dir/', :input => 'src/haml' do
watch %r{^src/haml/.+(\.html\.haml)(?!(\.swp))}
end
end
and now you start each in its own terminal:
guard -g first
guard -g second
Not quite elegant, but it'll work...