rack-fonts

Rack::Static wrapper to give more love to web fonts.

Usage

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 root option. (Note that you can indicate more that one URL in the urls option)

So, for instance:

use Rack::Fonts :root => 'public', :urls => ['/assets']

will respond to a request path /assets/images/nelson.gif with the file located in ./public/images/nelson.gif

In addition, 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.

See the examples/config.ru file to see an example on how to use it.

Licenses

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 protected].