text: // service-worker.js
  
  // set names for both precache & runtime cache
  workbox.core.setCacheNameDetails({
      prefix: 'my-blog',
      suffix: 'v1.0',
      precache: 'precache',
      runtime: 'runtime-cache'
  });
  
  // let Service Worker take control of pages ASAP
  workbox.core.skipWaiting();
  workbox.core.clientsClaim();
  
  // let Workbox handle our precache list
  workbox.precaching.precacheAndRoute(self.__precacheManifest);
  
  self.addEventListener('install', event => {
    const urls = [
      'https://cdn.ampproject.org/v0.js',
      'https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js',
      'https://cdn.ampproject.org/shadow-v0.js',
      'index.html',
      '/'
    ];
    const cacheName = workbox.core.cacheNames.runtime;
    event.waitUntil(caches.open(cacheName).then(cache => cache.addAll(urls)));
  });
  
  // use `NetworkFirst` strategy for `*.html`, like all my posts
  workbox.routing.registerRoute(/\.html$/, args => {
    return workbox.strategies.NetworkFirst().handle(args).then(response => {
      if (!response) {
        return caches.match('offline.html');
      }
      return response;
    });
  });
  
  // use `NetworkFirst` strategy for css and js
  workbox.routing.registerRoute(
      /\.(?:js|css)$/,
      new workbox.strategies.NetworkFirst()
  );
  
  // use `CacheFirst` strategy for images
  workbox.routing.registerRoute(
      /assets\/(img|icons)/,
      new workbox.strategies.CacheFirst()
  );
  
  // third party files with StaleWhileRevalidate
  workbox.routing.registerRoute(
      /^https?:\/\/cdn.staticfile.org/,
      new workbox.strategies.StaleWhileRevalidate()
  );
  
  workbox.routing.registerRoute(
      /(.*)cdn\.ampproject\.org(.*)/,
      new workbox.strategies.StaleWhileRevalidate()
  );
  