Saturday, 15 August 2015

How can I "pipe" input from one guard to another? -



How can I "pipe" input from one guard to another? -

i'm trying out guard, , write handlebars templates using haml. there way "pipe" output of guard-haml guard-handlebars (i.e. have 2 guards operate on same file)? or perhaps, there guard plugin can both steps?

cobbled solution using guard-shell. fundamental problem guard-handlebars expects it's input files end in ".handlebars" , there no configuration alternative alter that. rather patch guard-handlebars, used guard-shell rename files after guard-haml had processed them. here resulting code in guardfile:

guard 'haml', :input => 'src/templates', :output => 'public/js/templates/html' watch %r{^.+(\.hbs\.haml)$} end guard :shell watch %r{^public/js/templates/html/.+(\.hbs\.html)$} |m| path = m[0] new_path = path.gsub(/\.hbs\.html$/, '.handlebars') `mv #{path} #{new_path}` end end guard 'handlebars', :input => 'public/js/templates/html', :output => 'public/js/templates' watch %r{^.+(\.handlebars)$} end

guard

No comments:

Post a Comment