Question

I have a guardfile whose sole purpose is to recompile coffeescript files into js and sass files into css. So I created a Gemfile as:

source :rubygems

group :development do
  gem 'therubyracer'
  gem 'guard-coffeescript'
  gem 'guard-sass'
  gem 'ruby_gntp'
end

and a Guardfile as:

group :development do
  guard :coffeescript, :all_on_start => true, :input => '.', :output => '.'
  guard :sass, :input => 'css', :output => 'css'
end

When I do bundle exec guard, I get this:

Guard uses GNTP to send notifications.
Guard is now watching at '/Users/sxross/Developer/Safari Extensions/iStockphoto/iStockphoto.safariextension'
Compile 
Successfully generated 
ERROR: Error sending notification with gntp: Connection refused - connect(2)

The sass is being successfully generated, but not the coffee script. I'm also wrestling with the GNTP issue. I'm running on Lion, and have the latest version of Growl and Growl Notifier. I just installed the ruby_gntp gem, so that should be current.

For background, this is a huge hammer designed to get around the fact that coffee -wc foo.coffee compiles initially, then compiles the first change, then never again does anything.

Thanks

Was it helpful?

Solution

Looks like you have to place your CoffeeScript files inside a directory in order for guard-coffeescript to work. You can't have the CoffeeScript files in the same directory as the Guardfile.

Update:

Did a little further investigation and noticed that if you place the input file regex inside the block instead of using the :input parameter, you can actually use CoffeeScript files in the current directory.

Change your Guardfile to something like this:

guard :coffeescript, :all_on_start => true, :output => '.' do
  watch(%r{(.+\.coffee)})
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top