Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thepassle/rollup-plugin-apply-sw-registration
Rollup plugin that appends minified service worker registration code to the end of the document body
https://github.com/thepassle/rollup-plugin-apply-sw-registration
Last synced: 28 days ago
JSON representation
Rollup plugin that appends minified service worker registration code to the end of the document body
- Host: GitHub
- URL: https://github.com/thepassle/rollup-plugin-apply-sw-registration
- Owner: thepassle
- Created: 2020-03-28T08:57:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T17:32:41.000Z (almost 2 years ago)
- Last Synced: 2024-10-05T07:43:11.155Z (about 1 month ago)
- Language: JavaScript
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rollup-plugin-apply-sw-registration
Rollup plugin that appends minified service worker registration code to the end of the document body. This can be useful if you only want to apply the service worker for your production build, and not during development.
Example usage:
```js
import applySwRegistration from 'rollup-plugin-apply-sw-registration';
import html from '@open-wc/rollup-plugin-html';export default {
input: 'demo/index.html',
output: {
dir: 'demo/dist'
},
plugins: [
html(),
applySwRegistration()
]
}
```Customized:
```js
import applySwRegistration from 'rollup-plugin-apply-sw-registration';
import html from '@open-wc/rollup-plugin-html';export default {
input: 'demo/index.html',
output: {
dir: 'demo/dist'
},
plugins: [
html(),
applySwRegistration({
htmlFileName: 'custom-index.html',
prefix: 'foo',
scope: 'bar',
swName: 'custom-sw.js'
})
]
}
```## Configuration
| name | type | description |
| ------------- | -------------- | ----------------------------------------------------------------------- |
| htmlFileName | string | custom html file name, 'index.html' by default |
| prefix | string | custom prefix |
| scope | string | will add a custom scope to the sw registration. |
| swName | string | custom service worker name |