Repository navigation
Releases
Releases · owebstudio/kirby-pwa
2.0.0
Kirby PWA now really works offline, on Kirby 5 and Kirby 6.
New
- Offline support. The service worker caches the pages your visitors open and the files they use. Without a connection, visited pages still load, and all other pages show an offline page.
- Offline page. Create a page with the ID
offlineand edit it in the Panel, or use the built-in page and override itspwa/offlinesnippet. - Sensible caching. Pages come from the network first, Kirby's media files from the cache, and other images, scripts, styles and fonts from the cache while they update in the background.
- Never in the way. The Panel, the API, form submissions, other domains and previews are never touched, and responses that must not be stored are not cached.
- Updates. Every change of the plugin, its options or the offline page creates a new service worker that replaces the old one and removes its caches. Set the
versionoption to force an update. - New options:
offline,precache,exclude,strategies,limitsandversion. - Install button:
snippet('pwa/install')shows a button when the browser allows the installation, and a hint on iOS. - Update notice:
snippet('pwa/update')asks visitors to reload when a new version takes over. - JavaScript events (
pwa:installable,pwa:installed,pwa:update) andwindow.kirbyPwa.install()for your own UI. - Texts in English, German and Turkish.
Changed
- The manifest follows the standard: it no longer contains
splashandstatus_bar. Both options still set the iOS tags. - The app name defaults to the title of your site, and the description is only added when you set one.
- All output of the snippet is escaped, and its inline scripts use Kirby's nonce, so they work with a Content Security Policy.
- The Windows 8 tile tags were removed.
Breaking changes
- Requires Kirby 5 or 6 and PHP 8.2 or newer. For Kirby 3.6 to 4, keep using 1.0.3.
- The global functions
optionsKirbyPwa(),snippetKirbyPwa()andgetArrayLastItem()were removed. Usesnippet('pwa'). - The service worker now caches pages. If parts of your site must always come from the network, like a cart or a checkout, add them to the
excludeoption.
See the README for all options and the upgrade notes.
Repository: https://github.com/owebstudio/kirby-pwa
License: MIT, see LICENSE
1.0.3
A bug fix release for Kirby 3.6 to Kirby 5.
Fixed
- The
pwasnippet no longer crashes the page on Kirby 5 when noiconsare set. Without icons, the icon tags are left out. snippetKirbyPwa()no longer throws an error after it echoes the snippet.- The
manifest.jsonandserviceworker.jsoptions now accept the path to your own file (absolute or relative to the site root). Before, a string value was ignored and the file returned a 404. - Icons get the right MIME type in the manifest, e.g.
image/svg+xmlfor SVG andimage/jpegfor JPG. - Shortcuts work without a
description, and shortcut icons without apurpose. - The service worker is registered with the same scope on every page. Before, the default scope
.was resolved against each page, so every section of the site registered its own worker. Those extra registrations are removed when a visitor opens any page. - A splash screen's own
mediaquery is now used.
Compatibility
Tested with Kirby 3.6, 3.10, 4.9 and 5.6 on PHP 7.4 to 8.5. composer.json now declares "compatible": "^3.6 || ^4.0 || ^5.0".
The service worker itself is unchanged and doesn't cache anything yet. Offline support comes with the Kirby 6 version.
Repository: https://github.com/owebstudio/kirby-pwa
License: MIT, see LICENSE