Sam Richard
@Snugug
BBQ lead, ChromeOS DevRel. Mostly food, sometimes design and development, especially for the web. 7008px tall. He/him.
An archive of my Twitter timeline up until I moved to Mastodon. You can find me there at @[email protected]
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:
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();
(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)