首页 > requirejs初学疑问?

requirejs初学疑问?

刚学requirejs,现在有个疑问,模块化后的代码都被打包成一个js文件,然后

<script data-main="src/js/app" src="src/js/require.js"></script>

然后在app.js这样

require.config({
    paths: {
      zepto: 'zepto',
      swiper: 'swiper',
      index :'index'
    }
});
 
require(['index'], function(index) {
    index.init();
});

如果我现在有个需求,在每个页面都有对应得js独有的操作,那是不是我还要写很多个app.js类似的require的代码,在页面引用不同的app.js啊,那这样的话,我还有必要打包压缩在一块,减少http的请求了吗?


http://www.it165.net/pro/html/201406/15981.html

这个应该是你想要的

【热门文章】
【热门文章】