Skip to content
Try to modularize Backbone's code with LiveScript.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
todos
README.md

README.md

require-ls-backone

A example project lets require-ls (A RequireJS loader plugin for LiveScript) and Backbone.js work together.

Try to modularize Backbone's code with LiveScript.

The original code from Backbone's example.

First, I re-organize to keep html, css, pic, .js of app (todos.js) in todos/ folder and put .js of libraries in todos/lib/ folder … index_bk.html is original index.html.

Second, write bootstrap files (app/main.js, app/lsmain.ls) for require-ls, and divide todos.js into model/view folders (app/model/*.js, app/view/*.js).

Finally, convert app/model/*.js, app/view/*.js to app/model/*.ls, app/view/*.ls.

Usage

  1. git clone this repo

     git clone https://github.com/tcc/require-ls-backbone.git 
    
  2. Firfox open todos/index.html as local file, otherwise it needs local web server (for require-ls).

Javascript version

Modify todos\app\lsmain.js as:

define ['app/view/app'], (AppView) ->
  $ -> new AppView

(Change 'ls:app/view/app' to app/view/app)

LiveScript version

Keep todos\app\lsmain.js as:

define ['ls:app/view/app'], (AppView) ->
  $ -> new AppView

Todo

You can’t perform that action at this time.