Skip to content

Instantly share code, notes, and snippets.

@ryancole
Created April 4, 2012 18:21
Show Gist options
  • Save ryancole/2304423 to your computer and use it in GitHub Desktop.
Save ryancole/2304423 to your computer and use it in GitHub Desktop.
require.config({
paths: {
use: '/public/js/lib/use',
json2: 'http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2',
jquery: 'http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min',
backbone: 'http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min',
underscore: 'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min'
},
use: {
underscore: {
attach: '_'
},
json2: {
attach: 'JSON'
},
backbone: {
deps: ['use!json2', 'use!underscore', 'jquery'],
attach: function (JSON, _, $) {
return Backbone
}
}
}
})
require(['use!backbone'], function (Backbone) {
// define route handler
var ApplicationRouter = Backbone.Router.extend({
routes: {
'/': 'list'
},
list: function () {
console.log('list')
}
})
// instantiate route handler
var router = new ApplicationRouter
// start backbone history manager
Backbone.history.start()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment