The modernizr-rails gem will include the Modernizr.js library into your
Rails 3.1+ app via the asset pipeline. This gem is bundled with the last tagged release version from the Modernizr GitHub repo, which is minified by the Rails Assets Pipeline for you automatically. If you need custom feature detection tests, consider the Custom feature detection tests section in this README.
Add the following to your
assets group in your Gemfile:
group :assets do gem 'modernizr-rails' end
Add the following into your Gemfile:
Modernizr should be added to the
<head> of your HTML. Be sure to check out the offical docs about Installing Modernizr for more info.
Include it using the helper like so
Example of your
If you need a custom feature detection test not included in the Modernizr build shipped with this gem, please consider using your own version instead of sending a pull request to include your test. You can easily do this by moving your Modernizr build in to one of the assets folder. Rails will automagically use your build instead of the shipped one. However you can still continue to use this gem and its features (like the precompile hook, and so on).
- Configure your build on modernizr.com/download.
- Download it.
- Rename it from
- Move it to your asset pipeline folder, ideally
- Enjoy your custom build! :)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
(The MIT license)
Copyright (C) 2011-2013 Russell Frisch (russfrisch)