From 2bfefbdb7d4a36d20c8396943dde423d54ed548d Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 30 Apr 2020 15:23:02 -0400 Subject: Hopefully this works --- nuxt.config.js | 1 + static/sw.js | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/nuxt.config.js b/nuxt.config.js index 7f24d0d..7881a99 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -7,6 +7,7 @@ module.exports = { meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, + { hid: 'title', name: 'title', content: 'Andrew Lee' }, { hid: 'description', name: 'description', content: 'Andrew\'s Personal Website' } ], link: [ diff --git a/static/sw.js b/static/sw.js index ea69899..3f26afe 100644 --- a/static/sw.js +++ b/static/sw.js @@ -1 +1,32 @@ -// THIS FILE SHOULD NOT BE VERSION CONTROLLED +importScripts('https://cdn.jsdelivr.net/npm/workbox-cdn@4.3.1/workbox/workbox-sw.js') + +// -------------------------------------------------- +// Configure +// -------------------------------------------------- + +// Set workbox config +workbox.setConfig({ + "debug": false +}) + +// Start controlling any existing clients as soon as it activates +workbox.core.clientsClaim() + +// Skip over the SW waiting lifecycle stage +workbox.core.skipWaiting() + +workbox.precaching.cleanupOutdatedCaches() + +// -------------------------------------------------- +// Precaches +// -------------------------------------------------- + +// Precache assets + +// -------------------------------------------------- +// Runtime Caching +// -------------------------------------------------- + +// Register route handlers for runtimeCaching +workbox.routing.registerRoute(new RegExp('/_nuxt/'), new workbox.strategies.CacheFirst ({}), 'GET') +workbox.routing.registerRoute(new RegExp('/'), new workbox.strategies.NetworkFirst ({}), 'GET') -- cgit v1.2.3