Respond.js provides a fast and lightweight script to enable responsive web designs in browsers that don't support CSS3 media queries. You can find the original source repository at


Include the gem in your Gemfile:

    gem "respond-rails", "~> 1.0"

Include Respond.js in your application layout like so:

    <%= respond_include_tags %>

And add respond.js to the list of precompiled assets:

# config/environments/production.rb

config.assets.precompile += %w( modernizr.js respond.js respond-proxy.html respond.proxy.js )

CDN/X-Domain Setup

If you store your assets on a separate host, you'll need to edit asset_host like so:

# config/environments/production.rb

config.action_controller.asset_host = { |source, request|
  if source =~ /respond\.proxy-.+(js|gif)$/

This will skip the asset_host for respond.proxy.js and respond.proxy.gif which need to be on the same domain. After that, you'll need to make an addition to the precompiled assets:

config.assets.precompile += %w( respond.js respond-proxy.html respond.proxy.js )


Copyright (c) 2011 Scott Jehl,

See for details.