Git Product home page Git Product logo

backbone-on-rails's Introduction

Backbone on Rails

A simple gem for using Backbone.js with Rails.

http://git.io/backbone-on-rails

Features

  • Vendors the latest Backbone.js + Underscore.js in the asset pipeline

  • Provides an install generator to create a skeleton directory structure and manifest

  • Provides a scaffold generator to create files and boilerplate

  • Uses the naming conventions from thoughtbot's Backbone.js on Rails

  • Generates CoffeeScript (default) or JavaScript

Usage

gem 'backbone-on-rails'

bundle install

rails generate backbone:install

rails generate backbone:scaffold NAME

Note: Remember to restart the server after installing

See also:

Output

Example output from backbone:scaffold planet

app/assets/
├── javascripts
│   ├── application.js
│   ├── space_app.js.coffee
│   ├── collections
│   │   └── planets.js.coffee
│   ├── models
│   │   └── planet.js.coffee
│   ├── routers
│   │   └── planets_router.js.coffee
│   └── views
│       └── planets
│           └── planets_index.js.coffee
└── templates
    └── planets
        └── index.jst.eco

Tricks

# Custom manifest
rails generate backbone:install --manifest index.js

# Generate JavaScript
rails generate backbone:install --javascript

# Custom Appname
rails generate backbone:install --app=CustomApp

# Place code within a sub directory structure
rails generate backbone:install --dir=custom_app

# Remove generated files
rails destroy backbone:scaffold planet

# Create a custom app name
rails generate backbone:scaffold planet -a=CustomApp

# Generate scaffold in sub directory of assets/javascripts & assets/templates
rails generate backbone:scaffold planet -d=custom_app

# Use Handlebars File instead of JST
rails generate backbone:scaffold planet --template=hbs

# Use SHT instead of JST as template namespace
rails generate backbone:scaffold planet --template_namespace=SHT

Alternatives

For other features check out:

backbone-on-rails's People

Contributors

meleyal avatar ncolgan avatar brockers avatar manzhikov avatar dahal avatar andrewhubbs avatar billychan avatar derekprior avatar drale2k avatar jwarzech avatar kchung avatar pklingem avatar sascha avatar taavo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.