If you’re familiar with Express, sw-toolbox supports URL patterns using a similar syntax to its routing syntax.
This will intercept GET requests for any PNG/JPG file under the img folder. It handles requests according to the cacheFirst strategy, first checking the cache for a response. If that fails, the request gets sent to the network. If that succeeds, the response gets added to the cache.
Full domains can also be used here, e.g this will cache your Google Fonts:
We can also intercept GET requests to another domain using Express-style routing. We just define an ‘origin’ property in our options (a string or RegExp) which gets matched against the full origin of the URL.
... read the whole story at medium.com.