Bartosz Dziewoński | 16 Dec 2011 22:31
Picon

Re: Camping.use Before, Rack::File.new('public')

I usually just use Rack::Static:

module App
  use Rack::Static, :urls => ['/static']
end

This would serve ./static/jquery.js at
localhost:3301/static/jquery.js, though - with the directory included
in URL - but will also serve files from subdirectories recursively (I
don't know if Rack::File does this).

-- Matma Rex
Magnus Holm | 17 Dec 2011 10:34
Picon
Gravatar

Re: Camping.use Before, Rack::File.new('public')

2011/12/16 Bartosz Dziewoński <matma.rex <at> gmail.com>:
> I usually just use Rack::Static:
>
> module App
>  use Rack::Static, :urls => ['/static']
> end
>
> This would serve ./static/jquery.js at
> localhost:3301/static/jquery.js, though - with the directory included
> in URL - but will also serve files from subdirectories recursively (I
> don't know if Rack::File does this).

Yeah, that works, but I hate how /static/ is needed in the URL. The
only reason Before is actually needed is because no-one in Rack
thought of creating a Rack::File-ish middleware. Rack::Cascade works
nice, but it can't be used as a middleware. This simply turns
Rack::Cascade into a middleware.
_______________________________________________
Camping-list mailing list
Camping-list <at> rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Gmane