Created
October 28, 2012 15:46
-
-
Save zhuochun/3968944 to your computer and use it in GitHub Desktop.
RequireJS + jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ======================================== | |
* <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 | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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