Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Created January 14, 2011 22:01
Show Gist options
  • Save jejacks0n/780348 to your computer and use it in GitHub Desktop.
Save jejacks0n/780348 to your computer and use it in GitHub Desktop.
require 'rack'
module Middleware
class Jammit
ROOT = '/app/javascripts'
def initialize(app, options = {})
@app = app
@file_server = ::Rack::File.new(Protosite::Engine.root)
end
def call(env)
return @file_server.call(env) if env['PATH_INFO'].match(%r(#{ROOT}))
@app.call(env)
end
end
end
@jejacks0n
Copy link
Author

app.middleware.insert_after ::ActionDispatch::Static, Middleware::Jammit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment