百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

modernizr-rails

> 编程语言
开源

Gem 包装器,可通过 Rails 3.1 资产管道包含 Modernizr.js 库。

171 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Gem 包装器,可通过 Rails 3.1 资产管道包含 Modernizr.js 库。

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

Installation

Rails 3.x

Add the following to your assets group in your Gemfile:

ruby
group :assets do
  gem 'modernizr-rails'
end

Rails 4.x

Add the following into your Gemfile:

ruby
gem 'modernizr-rails'

Usage

Modernizr should be added to the of your HTML. Be sure to check out the [offical docs](http://modernizr.com/docs/#installing) about **Installing Modernizr** for more info. Include it using the helper like so, Rails will take care of the compilation and minification automatically for you.

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

erb

  Your Awesome App
  
  
  

  ...
  

Custom feature detection tests

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

  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.

Issues· 3 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言