Home > wq.build > wq serviceworker

wq serviceworker

wq serviceworker: Generate a service-worker.js. Provided by wq.build.

$ wq serviceworker --help

Usage: wq serviceworker [OPTIONS] VERSION

  Generate a service-worker.js.  The default service worker will function as
  follows:

  1. While installing, precache all of the listed paths.
  2. While running, attempt to fetch (and re-cache) the latest version
     of each file, but fall back to the cached version after the specified
     timeout.

  This ensures the app can work offline as needed, without requiring a double
  refresh whenever a new version is available.  Specify the --template option
  to override the default.

  The list of files to cache should be relative to the directory containing
  service-worker.js.  Wildcard paths will be resolved to existing filenames,
  so this command should generally be run *after* ./manage.py collectstatic.

  Note: If you are using wq with npm, a service worker will be generated by
  create-react-app, so you do not need to use this command.

Options:
  --template PATH    Override service worker template
  --output PATH      Destination file (default: ./htdocs/service-worker.js)
  --cache PATH       File(s) or directories to cache
  --exclude PATH     Individual file names to exclude from cache
  --scope TEXT       Path prefix for service worker and cached files
  --timeout INTEGER  Timeout to use before falling back to cache.
  --help             Show this message and exit.