Rack::Static wrapper to give more love to web fonts.
This middleware merely wraps the Rack::Static one so it admits the same options:
:root => "public"
looks for all the assets under the
public subdirectory of the current directory
:urls => ["/assets"]
intercepts the requests beginning with
/media and tries to serve static files
from the directory specified by the
(Note that you can indicate more that one URL in the
So, for instance:
use Rack::Fonts :root => 'public', :urls => ['/assets']
will respond to a request path
with the file located in
Rack::Fonts supports a
:cache_time option to easily indicate
a cache expiration for your assets.
Apart from that, it will return appropiate
Content-Type for webfonts and will
add set the
Access-Control-Allow-Origin header to
*, so strict browsers like
Firefox will be able to use these assets from different sites.
examples/config.ru file to see an example on how to use it.
The test/assets directory includes the Forum font in several formats, see the Forum-Font-License-OFL.txt file to see the font license.
See the LICENSE file included in the distribution for the rest of the code.
Copyright (C) 2011 Raul Murciano email@example.com.