Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

3.0.0

Compare
Choose a tag to compare
@jeffposnick jeffposnick released this 10 Feb 11:40
· 131 commits to master since this release

What's New?

sw-toolbox Integration

sw-precache is meant to be used hand-in-hand with a runtime caching library like sw-toolbox, with sw-precache handling your App Shell and sw-toolbox handling your dynamic content.

Previously, using them both together required installing the sw-toolbox package separately and pulling it in via the importScripts option, which made a common use case overly complicated.

Now, it's possible to automatically include and configure sw-toolbox via a new sw-precache option, runtimeCaching. You can configure both your App Shell and dynamic caching strategies in one location, along the lines of:

var config = {
  runtimeCaching: [{
    // See https://github.com/GoogleChrome/sw-toolbox#methods
    urlPattern: /runtime-caching/,
    handler: 'cacheFirst',
    // See https://github.com/GoogleChrome/sw-toolbox#options
    options: {
      cache: {
        maxEntries: 1,
        name: 'runtime-cache'
      }
    }
  }],
  staticFileGlobs: [
    rootDir + '/css/**.css',
    rootDir + '/**.html',
    rootDir + '/images/**.*',
    rootDir + '/js/**.js'
  ]
};

The gulpfile.js in the demo/ directory includes a complete sample of configuring both App Shell and dynamic content caching.

Getting Started Guide

The Getting Started Guide lays out some common terminology and helps developers understand how to think about the specific caching needs of their web app.

External Config for sw-precache Command Line

Developers who prefer using the command line sw-precache binary can now store their configuration in an external JSON file. This makes it much easier to use a complex configuration without having to wrangle command line flags.

PRs Since Previous Release