Skip to content

Instantly share code, notes, and snippets.

@andrewkolesnikov
Created September 24, 2010 17:22
Show Gist options
  • Save andrewkolesnikov/595714 to your computer and use it in GitHub Desktop.
Save andrewkolesnikov/595714 to your computer and use it in GitHub Desktop.
get %r{^/([a-zA-Z0-9_/-]+\.coffee)\.js} do |filename|
content_type :js
base_name = options.public + '/' + filename
if File.exists? base_name
haml File.open(base_name, 'r'){|f| f.read }, :layout => false
else
File.open(base_name + '.js', 'r'){|f| f.read }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment