Using Coffee Script with Serve

  1. Add the "rack-coffee" gem to your Gemfile

  2. Add these lines to your config.ru file:

    require 'rack/coffee' 
    use Rack::Coffee, { 
      :urls => '/javascripts/', 
      :output_path => '/public/javascripts' 
    }
  3. Run bundle in your project folder.

Now you can put your .coffee files in /javascripts and link to them as usual (replacing .coffee with .js). For example, the URL for /javascripts/test.coffee is /javascripts/test.js.