Skip to content
mjumbewu edited this page Oct 6, 2012 · 1 revision

What I do when I create a new JavaScript project:

  • Create a libs directory for 3rd-party libraries

  • Download Backbone, Underscore, Bootstrap, jQuery, and sometimes Mustache, Leaflet

  • Create an index.html file, and include all the libraries

  • Come up with a namespace name for my project

  • Create models.js, routes.js, cause I know I'm gonna need them

  • Create app.js for my application conductor (controller?) object

      var <Namespace> = <Namespace> || {};
    
      (function(NS) {
    
        NS.App = function() {
          // Create model caches and top-level views here.
        };
    
      })(<Namespace>);
    
  • At the bottom of index.html, load the JS files, and create an app object:

      <script>
        $(function() {
          <Namespace>.app = new <Namespace>.App()
        });
      </script>
    
Clone this wiki locally