├── _config.yml ├── LICENSE └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker 2 | title: Patch.js 3 | description: Patch.js is a character level increment script loader for mobile Web. 4 | github: 5 | repository_url: https://github.com/patchjs 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2018-present Alibaba Group Holding Limited. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Website 2 | 3 | https://patchjs.github.io/ 4 | 5 | ## Our new GitHub repo 6 | 7 | https://github.com/patchjs 8 | 9 | ## Key Future 10 | 11 | * simple and easy to use API, like Labjs. 12 | 13 | * support localStorage / Web SQL Database / IndexedDB. 14 | 15 | * real time diff compute through nginx. 16 | 17 | * build diff compute through webpack. 18 | 19 | 20 | ## Loader 21 | 22 | ### Reference 23 | 24 | ```html 25 | 26 | 27 | ``` 28 | 29 | ### API 30 | 31 | ```js 32 | patchjs.config({ 33 | path: 'http://static.domain.com/path/to/', 34 | cache: true, 35 | increment: true, 36 | version: '0.1.0' 37 | }).load('index.css').load('common.js').wait().load('index.js', function (url, fromCache) { 38 | // fromCache 39 | }); 40 | ``` 41 | 42 | [More](https://github.com/patchjs/patchjs-loader) 43 | 44 | ### Service Worker 45 | 46 | ```js 47 | importScripts('./sw-core.js'); 48 | 49 | sw.config({ 50 | cacheId: 'cachedb', 51 | precache: [ 52 | './images/test.png', 53 | 'https://gw.alipayobjects.com/zos/rmsportal/CtJlgAZbmyeSCLxqsgqF.png' 54 | ], 55 | }).run(); 56 | ``` 57 | 58 | [More](https://github.com/patchjs/patchjs-sw) 59 | 60 | ## Nginx Configure 61 | 62 | ```bash 63 | location /static/ { 64 | patchjs on; 65 | patchjs_max_file_size 1024; 66 | } 67 | ``` 68 | 69 | [More](https://github.com/patchjs/patchjs-nginx-module) 70 | 71 | 72 | ## Webpack Configure 73 | 74 | ```js 75 | var PatchjsWebpackPlugin = require('patchjs-webpack-plugin'); 76 | 77 | module.exports = { 78 | plugins: [ 79 | new PatchjsWebpackPlugin({ 80 | increment: true, 81 | path: 'http://static.domain.com/path/to/' 82 | }) 83 | ] 84 | }; 85 | ``` 86 | 87 | [More](https://github.com/patchjs/patchjs-webpack-plugin) 88 | 89 | ## License 90 | 91 | Patch.js is MIT licensed. 92 | --------------------------------------------------------------------------------