Rails Assets

The solution to assets management in Rails*

Rails Assets is the frictionless proxy between Bundler and Bower.

It automatically converts the packaged components into gems that are easily droppable into your asset pipeline and stay up to date.

*It works with Sinatra too! See the demo.

{{ gem.name }}{{ gem.name }} {{{true: '', false: ', '}[$last]}}

gem 'rails-assets-{{ gem.name }}'
Include following in application.js:
//= require {{ gem.name }}
Include following in application.css:
*= require {{ gem.name }}
{{ gem.description }}
No description available.

All scripts:

All stylesheets:

Getting started


First, make sure you use bundler >= 1.8.4

Add https://rails-assets.org as a new gem source, then reference any Bower components that you need as gems in the following convention:

source 'https://rails-assets.org' do
  gem 'rails-assets-BOWER_PACKAGE_NAME'

During bundle install, if Bundler requests a package like this, Rails Assets’ daemon automatically will:

  • fetch the component from Bower’s registry,
  • analyze its manifest file, bower.json,
  • repackage the component as a valid Ruby gem and serve it to your application.

Dependencies are handled the same way recursively.


source 'https://rubygems.org'

+gem 'bundler', '>= 1.8.4'

gem 'rails'

gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'

+source 'https://rails-assets.org' do
+  gem 'rails-assets-bootstrap'
+  gem 'rails-assets-angular'
+  gem 'rails-assets-leaflet'

Asset pipeline

You can now require BOWER_PACKAGE_NAME in your stylesheets and JavaScript files—all assets exposed as main in bower.json will be automatically included.

Gems created by Rails Assets work great with any Sprockets-based application.


 //= require_self
+//= require bootstrap
+//= require angular
+//= require leaflet
 //= require_tree .
 //= require_tree shared

  *= require_self
+ *= require bootstrap
+ *= require leaflet
  *= require_tree .
  *= require_tree shared