Inspired by modernizr-server, Marshall Yount brings Modernizr to your Ruby web projects via some slick Rack middleware. The first time a user visits your site, rack-modernizr adds the Modernizr library to your page automatically and stuffs all that Modernizr info into a cookie that you can check on subsequent requests on the server side.
To install, grab the gem:
gem install rack-modernizr
To use in your Rack app, just require it in your rackup file:
# config.ru require ::File.expand_path('../config/environment', __FILE__) require 'modernizr' use Rack::Modernizr run MyApp::Application
In Rails, add the gem to your
Gemfile and configure the middleware in your
module MyApp class Application < Rails::Application config.middleware.use Rack::Modernizr end
Have comments? Send a tweet to @TheChangelog on Twitter.
Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.