I think workbox-recipes will make high-quality SWs much easier to create and maintain! A full SW that does network-first pages, stale-while-revalidate CSS, JS, and Web Workers, cache-first images, and caches Google Fonts, all w/an offline fallback, can be written in 1 tweet:

  • 1
  • 3
  1. import * as recipes from ‘workbox-recipes’; import { precacheAndRoute } from ‘workbox-precaching’;

    precacheAndRoute(self.__WB_MANIFEST);

    recipes.pageCache(); recipes.googleFontsCache(); recipes.staticResourceCache(); recipes.imageCache(); recipes.offlineFallback();

    • 0
    • 3
    1. (for the offline fallback to work, you’ll need to set up precaching and include offline.html in the precache manifest, but that’s the only additional config needed)

      • 0
      • 0