sw-pluginer
v1.2.0
Published
Tailwind CSS plugin to automatically register a service worker from a cached manifest. Perfect for offline-first PWAs.
Maintainers
Readme
sw-pluginer
Tailwind CSS plugin that automatically registers a service worker based on a cached manifest. Useful for offline-first PWAs where the service worker is supplied by a CDN.
Installation
npm install sw-pluginer
Usage
Add the plugin to your Tailwind config:
module.exports = {
plugins: [
require('sw-pluginer')
]
}Service worker update prompt (v1.2.0)
When a new service worker version is downloaded and waiting, the plugin now generates update-prompt UI components and client code so users can reload to pick up the latest version.
Add the banner markup anywhere in your HTML:
<div class="sw-update-prompt">
A new version is available.
<button type="button" class="sw-update-prompt__btn">Reload</button>
</div>The plugin registers these Tailwind components automatically:
.sw-update-prompt— fixed bottom-right banner (hidden by default).sw-update-prompt.is-visible— shown when an update is ready.sw-update-prompt__btn— reload button styled for the banner
