Add PWA capabilities
This commit is contained in:
parent
9283c26bf2
commit
b59b9d8f75
6 changed files with 116 additions and 12 deletions
26
assets/js/fontSW.js
Normal file
26
assets/js/fontSW.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* eslint-disable no-undef */
|
||||
|
||||
// Cache the Google Fonts stylesheets with a stale-while-revalidate strategy.
|
||||
workbox.routing.registerRoute(
|
||||
/^https:\/\/fonts\.googleapis\.com/,
|
||||
new workbox.strategies.StaleWhileRevalidate({
|
||||
cacheName: "google-fonts-stylesheets"
|
||||
})
|
||||
);
|
||||
|
||||
// Cache the underlying font files with a cache-first strategy for 1 year.
|
||||
workbox.routing.registerRoute(
|
||||
/^https:\/\/fonts\.gstatic\.com/,
|
||||
new workbox.strategies.CacheFirst({
|
||||
cacheName: "google-fonts-webfonts",
|
||||
plugins: [
|
||||
new workbox.cacheableResponse.Plugin({
|
||||
statuses: [0, 200]
|
||||
}),
|
||||
new workbox.expiration.Plugin({
|
||||
maxAgeSeconds: 60 * 60 * 24 * 365,
|
||||
maxEntries: 30
|
||||
})
|
||||
]
|
||||
})
|
||||
);
|
|
@ -4,15 +4,6 @@ export default {
|
|||
** Headers of the page
|
||||
*/
|
||||
head: {
|
||||
htmlAttrs: {
|
||||
lang: "en"
|
||||
},
|
||||
title: "Moritz Ruth",
|
||||
meta: [
|
||||
{ charset: "utf-8" },
|
||||
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
||||
{ hid: "description", name: "description", content: "The official website of Moritz Ruth" }
|
||||
],
|
||||
link: [
|
||||
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
|
||||
{ rel: "stylesheet", href: "https://fonts.googleapis.com/css?family=Alata&display=swap" }
|
||||
|
@ -45,8 +36,39 @@ export default {
|
|||
** Nuxt.js modules
|
||||
*/
|
||||
modules: [
|
||||
"svg-to-vue-component/nuxt"
|
||||
"svg-to-vue-component/nuxt",
|
||||
"@nuxtjs/pwa"
|
||||
],
|
||||
|
||||
// https://pwa.nuxtjs.org/modules/workbox.html
|
||||
workbox: {
|
||||
workboxExtensions: [
|
||||
"@/assets/js/fontSW.js"
|
||||
]
|
||||
},
|
||||
|
||||
pwa: {
|
||||
// https://pwa.nuxtjs.org/modules/meta.html
|
||||
meta: {
|
||||
viewport: "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0",
|
||||
mobileApp: false,
|
||||
name: "Moritz Ruth",
|
||||
author: "Moritz Ruth",
|
||||
description: "The official website of Moritz Ruth",
|
||||
lang: "en",
|
||||
themeColor: "#ffffff"
|
||||
},
|
||||
// https://developer.mozilla.org/en-US/docs/Web/Manifest
|
||||
manifest: {
|
||||
name: "Moritz Ruth",
|
||||
short_name: "Moritz Ruth",
|
||||
start_url: ".",
|
||||
background_color: "#ffffff",
|
||||
display: "browser",
|
||||
description: "The official website of Moritz Ruth",
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
** Build configuration
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxtjs/pwa": "^3.0.0-beta.19",
|
||||
"nuxt": "^2.0.0",
|
||||
"vue-ripple-directive": "^2.0.1"
|
||||
},
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
BIN
static/icon.png
Normal file
BIN
static/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
59
yarn.lock
59
yarn.lock
|
@ -979,6 +979,18 @@
|
|||
consola "^2.10.1"
|
||||
eslint-loader "^3.0.0"
|
||||
|
||||
"@nuxtjs/pwa@^3.0.0-beta.19":
|
||||
version "3.0.0-beta.19"
|
||||
resolved "https://registry.yarnpkg.com/@nuxtjs/pwa/-/pwa-3.0.0-beta.19.tgz#4685c8137a5b588126b3ee4d469f6806423f958f"
|
||||
integrity sha512-5c7CB2qrrlpu7BmJeWX9GN//uK1SiEzBbT+ykH11ZfUxQyXiO3QTm1f6tTOnG/P5v4kRIGYdBr0wmRbA/Hv1cw==
|
||||
dependencies:
|
||||
defu "^0.0.3"
|
||||
execa "^1.0.0"
|
||||
fs-extra "^8.1.0"
|
||||
hasha "^5.0.0"
|
||||
jimp-compact "^0.8.0"
|
||||
workbox-cdn "^4.3.1"
|
||||
|
||||
"@nuxtjs/youch@^4.2.3":
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
|
||||
|
@ -2431,7 +2443,7 @@ cross-spawn@^5.0.1:
|
|||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^6.0.5:
|
||||
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
|
||||
|
@ -2749,6 +2761,11 @@ defu@^0.0.1:
|
|||
resolved "https://registry.yarnpkg.com/defu/-/defu-0.0.1.tgz#74dc4d64e401d7f95c6755fe98bc5cd688833a8f"
|
||||
integrity sha512-Pz9yznbSzVTNA67lcfqVnktROx2BrrBBcmQqGrfe0zdiN5pl5GQogLA4uaP3U1pR1LHIZpEYTAh2sn+v4rH1dA==
|
||||
|
||||
defu@^0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/defu/-/defu-0.0.3.tgz#bdc3ea1e1ab2120d4d4a129147f3ba9b7f9fe103"
|
||||
integrity sha512-u/fe4fBwrD0KACvI0sYWTWFzooqONZq8ywPnK0ZkAgLNwaDTKpSWvMiiU4QmzhrQCXu8Y0+HIWP8amE18lsL4A==
|
||||
|
||||
delegates@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
|
||||
|
@ -3333,6 +3350,19 @@ execa@^0.8.0:
|
|||
signal-exit "^3.0.0"
|
||||
strip-eof "^1.0.0"
|
||||
|
||||
execa@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
|
||||
integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==
|
||||
dependencies:
|
||||
cross-spawn "^6.0.0"
|
||||
get-stream "^4.0.0"
|
||||
is-stream "^1.1.0"
|
||||
npm-run-path "^2.0.0"
|
||||
p-finally "^1.0.0"
|
||||
signal-exit "^3.0.0"
|
||||
strip-eof "^1.0.0"
|
||||
|
||||
execa@^3.2.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89"
|
||||
|
@ -3749,6 +3779,13 @@ get-stream@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
|
||||
integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=
|
||||
|
||||
get-stream@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
|
||||
integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==
|
||||
dependencies:
|
||||
pump "^3.0.0"
|
||||
|
||||
get-stream@^5.0.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9"
|
||||
|
@ -3923,6 +3960,14 @@ hash.js@^1.0.0, hash.js@^1.0.3:
|
|||
inherits "^2.0.3"
|
||||
minimalistic-assert "^1.0.1"
|
||||
|
||||
hasha@^5.0.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.1.0.tgz#dd05ccdfcfe7dab626247ce2a58efe461922f4ca"
|
||||
integrity sha512-OFPDWmzPN1l7atOV1TgBVmNtBxaIysToK6Ve9DK+vT6pYuklw/nPNT+HJbZi0KDcI6vWB+9tgvZ5YD7fA3CXcA==
|
||||
dependencies:
|
||||
is-stream "^2.0.0"
|
||||
type-fest "^0.8.0"
|
||||
|
||||
he@1.2.x, he@^1.1.0, he@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
|
||||
|
@ -4485,6 +4530,11 @@ jest-worker@^24.9.0:
|
|||
merge-stream "^2.0.0"
|
||||
supports-color "^6.1.0"
|
||||
|
||||
jimp-compact@^0.8.0:
|
||||
version "0.8.5"
|
||||
resolved "https://registry.yarnpkg.com/jimp-compact/-/jimp-compact-0.8.5.tgz#4dd5be1df94111902a58e6e698cbbdea9bdc1e0b"
|
||||
integrity sha512-BkpiX6jZyDVLU+CleO/6yF8SFHnyZXiElPryNjZx58AK1vy+bqSFvhKeFS680TISSr8IWqHlIAwDMMA0DTQkMw==
|
||||
|
||||
joycon@^2.1.2:
|
||||
version "2.2.5"
|
||||
resolved "https://registry.yarnpkg.com/joycon/-/joycon-2.2.5.tgz#8d4cf4cbb2544d7b7583c216fcdfec19f6be1615"
|
||||
|
@ -7823,7 +7873,7 @@ type-fest@^0.5.2:
|
|||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2"
|
||||
integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==
|
||||
|
||||
type-fest@^0.8.1:
|
||||
type-fest@^0.8.0, type-fest@^0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||
|
@ -8357,6 +8407,11 @@ word-wrap@~1.2.3:
|
|||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
|
||||
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
|
||||
|
||||
workbox-cdn@^4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/workbox-cdn/-/workbox-cdn-4.3.1.tgz#f1ffed5368c20291048498ba0744baf27dbd7294"
|
||||
integrity sha512-Adkgo+/7S+bBsDTzdeH0xxQCrfBM1EiyZlvu1tMh0cJ/ipC6TtA8KDr12PBREdbL0zO9hG+7OSzvi2NLchPAEg==
|
||||
|
||||
worker-farm@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue