Key Future
-
simple and easy to use API, like LABjs.
-
support localStorage / Web SQL Database / IndexedDB.
-
real time diff compute through nginx.
-
build diff compute through webpack.
Loader
Reference
<script src="./patchjs-loader/2.0.0/websqldb.js"></script>
<script src="./patchjs-loader/2.0.0/index.js"></script>
API
patchjs.config({
path: 'http://static.domain.com/path/to/',
cache: true,
increment: true,
version: '0.1.0'
}).load('index.css').load('common.js').wait().load('index.js', function (url, fromCache) {
// fromCache
});
Service Worker
importScripts('./sw-core.js');
sw.config({
cacheId: 'cachedb',
precache: [
'./images/test.png',
'https://gw.alipayobjects.com/zos/rmsportal/CtJlgAZbmyeSCLxqsgqF.png'
],
}).run();
Nginx Configure
location /static/ {
patchjs on;
patchjs_max_file_size 1024;
}
Webpack Configure
var PatchjsWebpackPlugin = require('patchjs-webpack-plugin');
module.exports = {
plugins: [
new PatchjsWebpackPlugin({
increment: true,
path: 'http://static.domain.com/path/to/'
})
]
};
Support & Contact
-
email: yulong.heli@gmail.com
-
issue: https://github.com/patchjs/patchjs-loader/issues