Patch.js

Patch.js is a character level increment script loader for mobile Web.

View on GitHub

Key Future

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 
});

More

Service Worker

importScripts('./sw-core.js');

sw.config({
  cacheId: 'cachedb',
  precache: [
    './images/test.png',
    'https://gw.alipayobjects.com/zos/rmsportal/CtJlgAZbmyeSCLxqsgqF.png'
  ],
}).run();

More

Nginx Configure

location /static/ {
    patchjs on;
    patchjs_max_file_size 1024;
}

More

Webpack Configure

var PatchjsWebpackPlugin = require('patchjs-webpack-plugin');

module.exports = {
  plugins: [
    new PatchjsWebpackPlugin({
      increment: true,
      path: 'http://static.domain.com/path/to/'
    })
  ]
};

More

Support & Contact