Skip to content
luyongfugx edited this page Sep 24, 2013 · 21 revisions

###在需要这个插件的页面里面引入plugin-storeinc.js

<script src="../sea-modules/seajs/seajs/2.1.1/sea-debug.js"></script>

//引入plugin-storeinc.js

<script src="../sea-modules/seajs/seajs/2.1.1/plugin-storeinc.js"></script>

<script>

// Set configuration

var version='1.0.6'

seajs.config({

base: "../sea-modules/",

alias: {

"jquery": "jquery/jquery/1.10.1/jquery.js"

}

});

seajs.use('plugin-storeinc', function(store) {

//关于增量更新的设置,

//store:true表示走本地存储

//inc:true 表示走增量更新

//jsver:本次的js版本

// aliasver: 设置了别名的js走自己的一个版本号,因为这部分基本很少改

// debug :是不是debug状态,如果是则走直接连接js的形式,不走本地存储和增量更新,方便调试

store.configStroreInc({'store':true,'inc':true,'jsver':version,'aliasver':'1.10.2','debug':false});

// For development

if (location.href.indexOf("?dev") > 0) {

seajs.use("../static/hello/src/main");

}

// For production

else {

seajs.use("examples/hello/"+version+"/main");

}

});

//然后安装适配增量更新插件的构建工具spm-storeinc-build

npm install spm-storeinc-build -g

新建文件package.json,内容如下:

{ "family": "examples", "name": "hello", "lastversion":"1.0.5", "version": "1.0.6", "chunkSize":12, "spm": { "alias": { "jquery": "jquery" }, "output": ["main.js", "style.css"] }` }

Clone this wiki locally