You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
9 months ago | |
---|---|---|
_config | 1 year ago | |
client | 10 months ago | |
src | 9 months ago | |
templates | 3 years ago | |
.editorconfig | 3 years ago | |
.eslintignore | 3 years ago | |
.eslintrc | 3 years ago | |
.gitignore | 3 years ago | |
.npmrc | 2 years ago | |
LICENSE | 5 years ago | |
README.md | 3 years ago | |
_config.php | 2 years ago | |
babel.config.json | 10 months ago | |
composer.json | 2 years ago | |
eslint.config.json | 10 months ago | |
package.json | 10 months ago | |
pnpm-lock.yaml | 10 months ago | |
sass-lint.yml | 10 months ago | |
webpack.config.common.js | 10 months ago | |
webpack.config.js | 10 months ago | |
webpack.config.serve.js | 10 months ago | |
webpack.yml | 10 months ago |
README.md
SilverStripe Progressive Web App
Tools to add progressive web app functionality to your silverstripe website And make it available offline
Installation
composer require a2nt/silverstripe-progressivewebapp
Usage
- Install the module, run dev/build and fill in the settings in the siteconfig
- Add js to register the service worker (example can be found at client/src/app.js)
if ('serviceWorker' in navigator) {
var baseHref = (document.getElementsByTagName('base')[0] || {}).href;
var version = (document.querySelector('meta[name="swversion"]') || {})
.content;
if (baseHref) {
navigator.serviceWorker
.register(baseHref + 'sw.js?v=' + version)
.then(() => {
console.log('SW: Registered');
});
}
}
- Add the following tags to the head of your website
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="{$BaseHref}manifest.json" />
<meta name="swversion" content="{$SWVersion}" />