Skip to content

Instantly share code, notes, and snippets.

@zhuochun
Created October 28, 2012 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuochun/3968944 to your computer and use it in GitHub Desktop.
Save zhuochun/3968944 to your computer and use it in GitHub Desktop.
RequireJS + jQuery
/* ========================================
* <Project> - <Description>
*
* Author:
* Last Edit:
* ========================================
* <License>
* ======================================== */
define(function(require, exports) {
"use strict";
/*jshint jquery:true, laxcomma:true, maxerr:50*/
// include other components
var component = require("path_to_component")
// declare private variables
, _i = {};
exports.init = function() {
// code here
};
});
// Require Configurations
require.config({
baseUrl : "js/libs"
, paths : {
"app" : "../app"
, "templates" : "../templates"
, "backbone" : "libs/backbone"
, "json2" : "libs/json2"
}
});
// Require Start
require(["app/main"], function(App) {
$(function() {
$("body").append("<h3>Hello Require</h3>");
App.init();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment