Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Modernizr JS assets for Sprockets/Rails

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 modernizr.gemspec
README.md

Modernizr Ruby Gem

Neatly packaged Modernizr JS assets for use in Sprockets or the Rails 3 asset pipeline.

Installation

Rails

Add modernizr to your Gemfile.

gem "modernizr"

Should be automatically added to your asset load path.

Sprockets

Add modernizr to your Gemfile as well, but you'll also have to manually setup your Sprockets load path. Depending on your setup, require modernizr and add Modernizr.path to your Sprockets environment.

env = Sprockets::Environment.new

require 'modernizr'
env.append_path Modernizr.path

Usage

Now you'll just need to require modernizr from your javascript bundle.

//= require modernizr

That will pull in all the core feature detections.

You can also pull in optional community detections:

//= require modernizr
//= require modernizr/contenteditable
//= require modernizr/cors
//= require modernizr/emoji

See a full list of community detects under feature-detects/.

Releases

New versions of this gem will only be published when there is a new stable version of Modernizr. Maybe if they do an official beta, I might too. But otherwise no untagged releases.

Caveats

This project isn't that interesting, yet...

If you look the Modernizr download page, you'll notice you can customize and opt out of alot more stuff. At the moment, this library can only exclude the detections in the community add-ons section. Kinda sucks.

Well, good news is that Modernizr v3 is supposed to moving most of its "core" feature detects out of the main file into seperate ones. Once this happens you'll be able to get the same level of granularity from this gem as the awesome download builder.

Follow along Modernizr issue #486.

Something went wrong with that request. Please try again.