Skip to content

tcc/require-ls-backbone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

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

About

Try to modularize Backbone's code with LiveScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published