码迷,mamicode.com
首页 > Web开发 > 详细

require js 将config和入口函数分开写

时间:2015-11-25 22:16:03      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:

原文地址

https://github.com/jrburke/requirejs/issues/354

Area there any plans to standardize/recommend a particular approach? If there is, I would suggest the following:

// homepage.html
<script data-id="requirejs" data-logic="home" data-main="js/config" src="js/lib/require.js"></script>

In, config.js

require.config({
    baseUrl: ‘js‘
});

// Load app logic as specified in `data-logic` attribute
require([document.querySelector(‘script[data-id="requirejs"]‘).getAttribute("data-logic")]);

require js 将config和入口函数分开写

标签:

原文地址:http://www.cnblogs.com/xiangniu/p/4995860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!