Coder Social home page Coder Social logo

ballweera / modernizr-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from russfrisch/modernizr-rails

0.0 2.0 0.0 64 KB

Gem wrapper to include the Modernizr.js library via the Rails 3.1 asset pipeline.

Home Page: http://rubygems.org/gems/modernizr-rails

License: MIT License

modernizr-rails's Introduction

modernizr-rails

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 development version from the Modernizr site, 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.

Installation

Add the following to your assets group in your Gemfile:

group :assets do
  gem 'modernizr-rails'
end

Usage

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 <%= javascript_include_tag :modernizr %>, Rails will take care of the compilation and minification automatically for you.

Example of your app/views/layouts/application.html.erb:

<html>
<head>
  <title>Your Awesome App</title>
  <%= stylesheet_link_tag    :application, media: :all %>
  <%= javascript_include_tag :modernizr %>
  <%= csrf_meta_tags %>
</head>
<body>
  ...
  <%= javascript_include_tag :application %>
</body>
</html>

Custom feature detection tests

I 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).

  1. Configure your build on modernizr.com/download.
  2. Download it.
  3. Rename it from modernizr.custom.12345.js to just modernizr.js.
  4. Move it to your asset pipeline folder, ideally vendor/assets/javascripts.
  5. Enjoy your custom build! :)

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

Copyright

(The MIT license)

Copyright (C) 2011-2013 Russell Frisch (russfrisch)

See LICENSE.md.

modernizr-rails's People

Contributors

ream88 avatar russfrisch avatar chrisnicola avatar kevinvangelder avatar kristianmandrup avatar gbh avatar pikachuexe avatar stamm avatar trliner avatar waynn avatar brunocruzcoelho avatar

Watchers

James Cloos avatar ballweera avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.