Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

chaplin need modify based Backbone.js #89

Closed
JianMeng opened this issue Jun 6, 2012 · 3 comments
Closed

chaplin need modify based Backbone.js #89

JianMeng opened this issue Jun 6, 2012 · 3 comments

Comments

@JianMeng
Copy link

JianMeng commented Jun 6, 2012

For now Backbone do not return a Backbone value to require.js need.

http://backbonejs.org/backbone-min.js

So the usage in chaplin like this:

define [
'jquery',
'underscore',
'backbone',
'chaplin/lib/utils',
'chaplin/lib/subscriber',
'chaplin/models/model'
], ($, _, Backbone, utils, Subscriber, Model) ->
'use strict'

class View extends Backbone.View
...

Maybe got a error of Backbone.VIew do not exist.

So user need add a return value (Backbone) to Backbone.js.

And this is also be done for underscore.js.

@flisky
Copy link
Contributor

flisky commented Jun 6, 2012

Currently BackBone & Underscore do not support AMD.
You may use require.js to load them like this under requirejs 2.0 -

require.config
  ...
  shim:
    backbone:
      deps: ["underscore", "jquery"]
      exports: "Backbone"

    underscore:
      exports: "_"

BR,

@molily
Copy link
Member

molily commented Jun 6, 2012

Right, the example apps (https://github.com/chaplinjs/chaplin-boilerplate and https://github.com/chaplinjs/facebook-example) are currently using modified, AMD-capable versions of Backbone and Underscore from this fork: https://github.com/amdjs
Maybe we should stress this fact better in the documentation.

We’ll switch to RequireJS 2.0 soon so a shim config will suffice. Loaders like https://github.com/cujojs/curl also provide such a feature, we’re going to give an example for that, too.

@JianMeng JianMeng closed this as completed Jun 6, 2012
@JianMeng
Copy link
Author

JianMeng commented Jun 6, 2012

@molily : I think a note in document would be helpful. ^_^

@flisky : Thank you, Shim work for me.
I was reading require.js code to figure out why this thing happened.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants