Search code examples
rubyguard

How do I specify an input for my Guardfile which points to a location in a parent directory?


I have a Guardfile which contains the following line:

guard 'coffeescript', :input => 'js', :output => 'js/compiled'

This works fine, but when I put the guardfile in its own directory and then change the line to this:

guard 'coffeescript', :input => '../js', :output => '../js/compiled'

It fails to detect any changes in js. Why is it failing to find js? Is there something wrong with my path notation?


Solution

  • You must run Guard from the base directory by typing

    guard --guardfile my_subdirectory/Guardfile
    

    or

    guard -G my_subdirectory/Guardfile
    

    and using your second Guardfile. it seems that Guard only sees files beneath the directory from which you started it. (Which makes sense, because else it would have to monitor the entire file system)