исправляет проблемы с PWA из cписка Lighthouse
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Maxim Slipenko 2022-05-20 16:36:26 +03:00
parent cb1fcaee05
commit a557f77d9c
Signed by: Maks1mS
GPG Key ID: 7461AF39A8705FB8
7 changed files with 2978 additions and 2 deletions

2956
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,8 @@
"prestart": "node ./scripts/symlink.js",
"start": "npx @11t/eleventy --serve",
"prebuild": "node ./scripts/symlink.js",
"build": "cross-env NODE_ENV=production npx @11t/eleventy",
"build": "cross-env NODE_ENV=production npx @11t/eleventy && npm run build:sw",
"build:sw": "workbox generateSW workbox-config.js",
"stylelint": "stylelint 'src/**/*.css'",
"eslint": "eslint src"
},
@ -33,7 +34,9 @@
"simple-git-hooks": "^2.7.0",
"stylelint": "^14.8.2",
"stylelint-config-standard": "^25.0.0",
"tailwindcss": "^3.0.24"
"tailwindcss": "^3.0.24",
"workbox-build": "^6.5.3",
"workbox-cli": "^6.5.3"
},
"dependencies": {
"alpinejs": "^3.10.2",

View File

@ -31,6 +31,8 @@ module.exports = (eleventyConfig) => {
}
}))
res[res.length - 1].purpose = 'maskable'
return JSON.stringify(res)
})
}

View File

@ -4,4 +4,6 @@ import Fuse from 'fuse.js'
window.Fuse = Fuse
window.Alpine = Alpine
if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js') }
Alpine.start()

View File

@ -6,6 +6,7 @@
<title>{{ title or metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}">
<meta name="generator" content="{{ eleventy.generator }}">
<meta name="theme-color" content="#fff"/>
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="/css/index.css">
{% favicon 'src/images/favicon.svg' %}

View File

@ -4,6 +4,7 @@
"start_url": "/",
"display": "standalone",
"background_color": "#fff",
"theme_color": "#fff",
"description": "Вики с различными полезными статьями",
"icons": {% manifest_icons 'src/images/favicon.svg', 48, 72, 96, 144, 148, 512 %}
}

11
workbox-config.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
globDirectory: 'dist/',
globPatterns: [
'**/*.{png,css,ico,svg,ttf,woff,woff2,js,json}'
],
swDest: 'dist/sw.js',
ignoreURLParametersMatching: [
/^utm_/,
/^fbclid$/
]
}