@io-arc/task-service-worker
Create a Service Worker
Last updated 4 days ago by arcone .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @io-arc/task-service-worker 
SYNC missed versions from official npm registry.

@io-arc/task-service-worker

Create a Service Worker.

Usage

$ NODE_ENV=development ia-sw

* There's no watch mode.

Execute src/sw.js if it exists.
It is created using generateSW of WorkBox.

sw.js

The minimum configuration required for execution.

// src/sw.js
module.exports = {
  manifest: {}
}

The globDirectory and swDest properties, which are required by WorkBox, are ignored even if they are specified because they are generated automatically.

Changing output file name

Default output file name is sw.js, but you can change the file name.

// src/sw.js
module.exports = {
  filename: 'foo.js',
  manifest: {}
}

// output 'path/dist/foo.js'

Manifest options

Take a look at WorkBox > generateSW

example

// src/sw.js
module.exports = {
  manifest: {
    ignoreURLParametersMatching: [/^utm_/],
    directoryIndex: 'index.html',
    globFollow: true,
    globIgnores: ['node_modules/**/*'],
    sourcemap: false
  }
}

Create a template

Command is $ ia-sw -t or $ ia-sw --template.
Create a sw.js underneath the src.

Current Tags

  • 0.0.2                                ...           latest (4 days ago)

2 Versions

  • 0.0.2                                ...           4 days ago
  • 0.0.1                                ...           4 days ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 15
Last Day 0
Last Week 15
Last Month 0
Dependencies (9)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |