Created
January 14, 2011 22:01
-
-
Save jejacks0n/780348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
app.middleware.insert_after ::ActionDispatch::Static, Middleware::Jammit