title: Requirejs for Backbonejs application
body: <p>I want to use Requirejs to run a Backbonejs application. Here is my basic setup.</p>
  
  <p>root/<br>
  root/index.htm<br>
  root/scripts/<br>
  root/scripts/require-jquery.js<br>
  root/scripts/order.js<br>
  root/scripts/main.js<br>
  root/scripts/app.js<br>
  root/scripts/app.build.js<br>
  root/scripts/backbone.js  </p>
  
  <p><strong>index.htm</strong></p>
  
  <pre><code>&lt;script data-main="scripts/main" src="scripts/require-jquery.js"&gt;&lt;/script&gt;
  &lt;div id="home"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>require([
      "order!http://documentcloud.github.com/underscore/underscore.js",
      "order!backbone",
      "order!app"
      ],function(_,Backbone,app){
      app.init();
  });
  </code></pre>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>define(["jquery","underscore"],function($,_){
      var init = function(){
          var arr = ['orange','apple','bannana'];
          _.each(arr,function(fruit){
              console.log(fruit);
          });
      };
  
      return { init: init };
  });
  </code></pre>
  
  <p><strong>backbone.js</strong></p>
  
  <pre><code>define(["order!http://documentcloud.github.com/backbone/backbone.js"], 
      function(){
          return Backbone;
  }); 
  </code></pre>
  
  <p>I haven't gotten to the Backbone stuff yet because I am running into an error with this current setup...</p>
  
  <p><strong>Line 150: _ is undefined at _.extend(Backbone.Model.prototype, Backbone.Events, {</strong> </p>
  
  <p>I am trying to make this thing as simple as possible and be able to eventually add my routers, models, etc...And build the thing down the road...</p>
  
  <p>What am I missing here in my setup to get this thing rocking?</p>
  
  <p>Also, would it be better in any way to use local js files instead of trying to load things from CDNs?</p>