MarionetteDust - Rails
Provides full integration between Marionette.js (and dependencies), Dust.js and the Asset Pipeline, also includes generators for a typical marionette application.
Installation
Add marionette_dust to your gemfile:
gem 'marionette_dust'
Download and install by running:
$ bundle install
Initialize your app with:
$ rails generate md:install
This adds //= require marionette_dust
in your application.js manifest and generates the basic scaffold for your marionette application:
app/
└── assets/
└── javascripts/
├── apps/
├── entities/
└── app.js
You can past an optional argument ( -c ) if you want coffeescript files.
Generators
All generators are based on marionette modules, the original idea is described in the excellent book Backbone.Marionette.js: A Gentle Introduction, and the all credits go to BackboneRails.com
Scaffold
Generates a scaffold for a sub-app, under apps folder, running:
$ rails generate md:scaffold Foo [-c]
will generate:
app/ └── assets/ └── javascripts/ ├── apps/ | └── foo/ | └── foo_app.js └── entities/ └── foo.js
Submodule
Generates a submodule under an existent app (previously generated with the Scaffold generator), running:
$ rails generate md:submodule bar --parent foo [-c]
will generate:
app/ └── assets/ └── javascripts/ ├── apps/ | └── foo/ | ├── bar/ | ├── bar_view.js | └── bar_controller.js | └── foo_app.js └── entities/ | └── foo.js └── templates/ └── foo/ └── bar/ └── bar.jst.dust
About
This version includes:
- Marionette.js v1.2.2
- Dust.js v2.2.2
Also this project is inspired by:
Backbone on rails and Dust assets
Special thanks to @sauron for making the test suite possible
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request