标签:
原文地址
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")]);
标签:
原文地址:http://www.cnblogs.com/xiangniu/p/4995860.html