1.0.0 • Published 4 years ago

rollup-plugin-apply-sw-registration v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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:

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:

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

nametypedescription
htmlFileNamestringcustom html file name, 'index.html' by default
prefixstringcustom prefix
scopestringwill add a custom scope to the sw registration.
swNamestringcustom service worker name
1.0.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago