Commit 8039215b authored by Jérome Perrin's avatar Jérome Perrin Committed by Thomas Gambier

generate a service worker

npm install workbox-cli
./node_modules/.bin/workbox injectManifest workbox-config.js

service worker: ignore query string for fonts

The compilation was run with 'ASSET_PATH="dist/" make'. This is needed
for officejs app because the HTML is not at the root of the domain
(https://converse.app.officejs.com/563950fb93/fullscreen.html).
parent cf66e829
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
For more information, please refer to <http://unlicense.org/> For more information, please refer to <http://unlicense.org/>
@licend @licend
*/ */
window.addEventListener('load', () => {
navigator.serviceWorker.register('sw.js');
});
converse.initialize({ converse.initialize({
authentication: 'login', authentication: 'login',
auto_away: 300, auto_away: 300,
......
This diff is collapsed.
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.4/workbox-sw.js');
workbox.core.setCacheNameDetails({
prefix: 'converse.nexedi',
});
// Note: this is populated at build time.
workbox.precaching.precacheAndRoute(self.__WB_MANIFEST,
// we ignore wvi0ht for urls like :
// /fonticons/fonts/icomoon.ttf?wvi0ht
{ ignoreUrlParametersMatching: [/^wvi0ht/] }
)
module.exports = {
globDirectory: '.',
globPatterns: [
'*.html',
'manifest.json',
'dist/**',
'css/**',
'locale/**',
'sounds/**',
'logo/**',
],
swSrc: 'sw.template.js',
swDest: 'sw.js',
maximumFileSizeToCacheInBytes: 1024**4
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment