Due to updates from Heroku, it now allows you to install the npm coffee-script source. The answer below was a workaround before Heroku fully supported node.js For a better solution, currently see a Higher Response Rating explaining how easy it is to use coffee-script from npm on Heroku.
Honestly, the best way would be to compile it before using it with coffee -c filename , as Peter suggested, but I'm wondering if there could be some kind of βpreloadβ preload.js that would call scripts using coffeescript like a node_module then compile () the script to be used. That way you can use them natively in node on heroku without having to deal with additional files in your repo.
npm install coffee-script
Then in the inital app write it in javascript and call the *.coffee files using the coffee compilation function:
var coffee = require('coffee-script'); coffee.compile('./server.coffee');
and in yourapp.coffee try
console.log 'It worked!'
I'm not sure if this will work, or even if this is even the correct syntax for this function. https://github.com/jashkenas/coffee-script/blob/master/lib/coffee-script.js#L24
If you are asking how to do this in ruby, here is this:
Walkthrough on using coffeescript on rails on Heroku: http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/
Suggested to use bistro_car ( https://github.com/jnicklas/bistro_car )
gem install bistro_car mkdir -p app/scripts
and adding it to Rails conf/environment.rb
config.gem 'bistro_car'
If I find something else or another way to run *.coffee javascript applications, I will update this answer, but hopefully this will give you some idea on how to make it work.
Here are some more examples, but they all seem to use ruby ββvs node.js:
http://forrst.com/posts/Doing_CoffeeScript_on_Heroku_a_Ruby_gem-OBk http://www.tangiblecolors.com/first-steps-with-coffeescript-and-how-to-use
Hope this helps a bit.