0.01
No commit activity in last 3 years
No release in over 3 years
rack middleware to serve static files with specified patterns. Check out http://gmarik.info/blog/2010/05/10/blogging-with-jekyll-and-heroku-for-free for more...
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

= 1.1.0
 Project Readme

How to

Install gem

gem install rack-try_static

Add Rack::TryStatic middleware to your config.ru(stack):

require 'rack'
require 'rack/contrib/try_static'

use Rack::TryStatic, 
    :root => "public",  # static files root dir
    :urls => %w[/],     # match all requests 
    :try => ['.html', 'index.html', '/index.html'] # try these postfixes sequentially

# otherwise 404 NotFound
run proc { [404, {'Content-Type' => 'text/html'}, ['whoops! Not Found']]}

Profit!

About

TryStatic middleware serves static content trying to find matching file. When match found it gets delegated to Rack::Static to be processed.

Examples

Blogging with Jekyll and Heroku for free.

TODO

  • √ specs
  • √ docs
  • √ merge to rack-cotrib