Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
camillobruni authored May 29, 2024
2 parents de528b9 + 437cb6d commit 4db64c1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 59 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"js": "shx mkdir -p dist/_js && terser src/_js/main.js -cm -o dist/_js/main.js",
"json": "json-minify src/.webmanifest > dist/.webmanifest",
"xml": "minify-xml --in-place dist/sitemap.xml && minify-xml --in-place dist/blog.atom && minify-xml --in-place dist/features.atom",
"sw": "workbox injectManifest workbox-config.js && terser dist/sw.js -cm -o dist/sw.js",
"sw": "terser src/sw.js -cm -o dist/sw.js",
"copy-img": "shx cp ./node_modules/@browser-logos/{chrome,firefox,node.js,safari}/*.svg src/_css/img/",
"copy-js": "shx cp ./node_modules/dark-mode-toggle/dist/dark-mode-toggle.min.mjs dist/_js/dark-mode-toggle.mjs",
"img-video-dimensions": "node add-image-and-video-dimensions.js",
Expand Down Expand Up @@ -70,7 +70,6 @@
"postcss-custom-properties": "^13.0.0",
"shx": "^0.3.4",
"superstatic": "^9.0.0",
"terser": "^5.16.0",
"workbox-cli": "^4.3.1"
"terser": "^5.16.0"
}
}
9 changes: 3 additions & 6 deletions src/_js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@
insertScript('https://platform.twitter.com/widgets.js');
}

// Install our service worker.
if ('serviceWorker' in navigator) {
addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
// Remove any existing service worker
navigator.serviceWorker.getRegistrations().then(
registrations => registrations.forEach(each => each.unregister()));

// Remove UTM garbage from URLs, to make it less likely such links get shared.
if (location.search.indexOf('utm_source') > -1) {
Expand Down
24 changes: 1 addition & 23 deletions src/sw.js
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the “License”);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// <https://apache.org/licenses/LICENSE-2.0>.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an “AS IS” BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.0.0-alpha.0/workbox-sw.js');

workbox.core.setCacheNameDetails({
prefix: 'v8.dev',
});

// Note: this is populated at build time.
workbox.precaching.precacheAndRoute([]);

workbox.skipWaiting();
// Keep empty until some near future and then remove it.
27 changes: 0 additions & 27 deletions workbox-config.js

This file was deleted.

0 comments on commit 4db64c1

Please sign in to comment.