0.01
No commit activity in last 3 years
No release in over 3 years
Modernizr is a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers. This gem integrates Modernizr with Rails asset pipeline for easy of use.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 3.0
~> 0.14
 Project Readme

Modernizr for rails asset pipeline

Modernizr is a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers.

The modernizr_rails gem integrates the Modernizr with the Rails asset pipeline.

Installation

Add this line to your application's Gemfile:

gem 'modernizr_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install modernizr_rails

Usage

There is two ways to use this gem. If you don't know which feature you'll need to test, add this line to your app/assets/javascripts/application.js to compile as a part of application.js

// Load all Modernizr javascripts
//= require modernizr

Or use the precompiled standalone javascript file by include it in your layout, like app/views/layouts/application.html.erb

<%= javascript_include_tag 'modernizr' %>

This will load all test scripts, including the Modernizr.load conditional script loader, based on yepnope.js.

If you already know which feature you need to test and don't want to load all these javascript files, you can load individual Modernizr javascript :

//= require modernizr-canvas
//= require modernizr-fontface
//= require modernizrtextshadow

This will also load the Modernizr.load conditional script loader.

If you need standalone modernizr.js file, you should add it to precompile list in config/application.rb

config.assets.precompile += %W(
  modernizr.js
)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Modernizr is available under the MIT licenses.

Other parts of gem use MIT license.