feat: i18n PWA webmanifests (#805)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
Joaquín Sánchez 2023-01-06 13:48:43 +01:00 committed by GitHub
parent 18056038c7
commit 85ac005570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 190 additions and 73 deletions

View file

@ -1,7 +1,5 @@
import { isCI, isDevelopment } from 'std-env'
import type { VitePWANuxtOptions } from '../modules/pwa/types'
import { APP_NAME } from '../constants'
import { getEnv } from './env'
export const pwa: VitePWANuxtOptions = {
mode: isCI ? 'production' : 'development',
@ -13,40 +11,9 @@ export const pwa: VitePWANuxtOptions = {
strategies: 'injectManifest',
injectRegister: false,
includeManifestIcons: false,
manifest: async () => {
const { env } = await getEnv()
const envName = `${env === 'release' ? '' : ` (${env})`}`
return {
scope: '/',
id: '/',
name: `${APP_NAME}${envName}`,
short_name: `${APP_NAME}${envName}`,
description: `A nimble Mastodon Web Client${envName}`,
theme_color: '#ffffff',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
/*
{
src: 'logo.svg',
sizes: '250x250',
type: 'image/png',
purpose: 'any maskable',
},
*/
],
}
},
manifest: false,
injectManifest: {
globPatterns: ['**/*.{js,json,css,html,txt,svg,png,ico,webp,woff,woff2,ttf,eot,otf,wasm}'],
globPatterns: ['**/*.{js,json,css,html,txt,svg,png,ico,webp,woff,woff2,ttf,eot,otf,wasm,webmanifest}'],
globIgnores: ['emojis/**'],
},
devOptions: {