Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Forked from rmurphey/gist:5551495
Last active August 29, 2015 14:15
Show Gist options
  • Save joseluisq/dd43f6ebf99a2f7bbf22 to your computer and use it in GitHub Desktop.
Save joseluisq/dd43f6ebf99a2f7bbf22 to your computer and use it in GitHub Desktop.
require(['app'], function (App) {
App.init();
});
//app.js
define([
'pages'
], function (pages) {
return {
init : function () {
var page = pages();
page()
}
};
})
//
// pages.js
define([
'pages/home',
'pages/static'
], function (home, static) {
return function () {
var pages = {
home : home,
static : static
};
var page = $('body').attr('data-page');
return pages[page];
}
})
// pages/home.js
define([], function () {
return function () {
$(document).ready(function () {
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment