gulp-turbo
Version:
前端工作流(requirejs/jade/stylus/coffee),完整强缩进工作流,同步异步模板复用,高效率适合初期前端团队
44 lines (37 loc) • 993 B
JavaScript
require.config({"paths":{"jade":"http://static.xxxx.com/vender/runtime"},"baseUrl":"//static.xxxx.com/js/"});
/**
* 只与本页面相关的js逻辑写在这里
*/
require([
'tpl/loder_demo_body'
],
function (tpl){
/**
* 用数据渲染body模板,并追加到document.body下
* @param {object} data 模板数据
* @return {[type]}
*/
function appdBody(data){
var o = document.createElement("div");
o.innerHTML = tpl(data)
document.body.appendChild(o)
}
// console.error 123
/**
* 按依赖顺序执行模块的init方法。
* @return {[type]} [description]
*/
function initMods(){
var mods = Array.prototype.slice.call(arguments);
for(var i = 0; i < mods.length; i++){
var mod = mods[i];
if(mod && typeof mod.init === 'function'){
mod.init();
}
}
}
//$CONFIG渲染页面模板
appdBody($CONFIG);
//init
initMods.apply(null, arguments);
});