Skip to content

Commit

Permalink
Merge pull request #67 from iamsolarpowered/coffee
Browse files Browse the repository at this point in the history
Prevent layout being applied to CoffeeScript files
  • Loading branch information
jlong committed Feb 16, 2012
2 parents f367e7e + d95719f commit f0dcb3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/serve.rb
Expand Up @@ -15,4 +15,5 @@ def singleton_class
require 'serve/handlers/less_handler'
require 'serve/handlers/email_handler'
require 'serve/handlers/redirect_handler'
require 'serve/handlers/coffee_handler'
require 'serve/rack'
14 changes: 14 additions & 0 deletions lib/serve/handlers/coffee_handler.rb
@@ -0,0 +1,14 @@
module Serve #:nodoc:
class CoffeeHandler < FileTypeHandler #:nodoc:
extension 'coffee'

def parse(string)
engine = Tilt::CoffeeScriptTemplate.new { string }
engine.render
end

def content_type
'text/javascript'
end
end
end

0 comments on commit f0dcb3a

Please sign in to comment.