Skip to content

Using marionette with rails asset pipeline

derickbailey edited this page May 17, 2012 · 1 revision

The easiest way to use Marionette with Rails and the Rails Asset Pipeline is with the marionette-rails gem.

From the marionette-rails documentation ...

Dependencies

Backbone.Marionette depends on Backbone (and Backbone's dependencies). These dependencies are not currently managed by the marionette-rails gem directly, because there exists multiple options to use Backbone with the Rails asset pipeline, such as backbone-on-rails, backbone-rails, rails-backbone, just to name a few.

Usage

Add it to your Gemfile:

group :assets do
  # Your other asset gems (sass-rails, coffee-rails, etc)
  
  gem 'marionette-rails'
end

Then add this to app/assets/javascripts/application.js.coffee:

#= require backbone.marionette

Or, if you are using pure javascript, add this to app/assets/javascripts/application.js:

//= require backbone.marionette