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

2011-12-16 Thread Magnus Holm
Here's one useful snippet:

  def (Before=).new(a,*o)Rack::Cascade.new(oa)end

This means that this app:

  module App
use Before, Rack::File.new('public')
  end

Will pass all requests through Rack::File.new('public') first, and
only proceed to App if that returns 404. This can be very useful for
serving static stuff in development mode (Rack::File will serve files
from the 'public' directory if it matches the URL; e.g.
./public/jquery.js will be available at localhost:3301/jquery.js)

Maybe we should add it to camping.rb?

// Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list


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

2011-12-16 Thread David Susco
I think that's immensely useful. It'll allow me to keep JS/CSS/HTML
separate from the app files but still packaged with the app.

Dave

On Fri, Dec 16, 2011 at 3:13 PM, Magnus Holm judo...@gmail.com wrote:
 Here's one useful snippet:

  def (Before=).new(a,*o)Rack::Cascade.new(oa)end

 This means that this app:

  module App
    use Before, Rack::File.new('public')
  end

 Will pass all requests through Rack::File.new('public') first, and
 only proceed to App if that returns 404. This can be very useful for
 serving static stuff in development mode (Rack::File will serve files
 from the 'public' directory if it matches the URL; e.g.
 ./public/jquery.js will be available at localhost:3301/jquery.js)

 Maybe we should add it to camping.rb?

 // Magnus Holm
 ___
 Camping-list mailing list
 Camping-list@rubyforge.org
 http://rubyforge.org/mailman/listinfo/camping-list



-- 
Dave
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list