I think it would be a nice feature to have the possibility to keep at least some keys of the manifest file dynamic to get them from an api for example. One use case would be to change the app icon without having to create a new build.
As a proof of concept I wrote a module with a server handler that can return a manifest. (and replaced hrefs from manifest.webmanifest to my manifest route
export default defineEventHandler((event) => {
setResponseHeaders(event, {
"Content-Type": "application/manifest+json"
})
const test = Math.random() * 12
// maybe fetch some api (configured via config) to merge default config and dynamic keys via defu
return { /* this might be replaced by e.g. $fetch(/api/manifest-overrides) + merge with default*/
"name": `Vitesse for Nuxt ${test}`,
"short_name": `Vitesse for Nuxt ${test}`,
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"lang": "en",
"scope": "/",
"id": "/",
"description": `Vitesse for Nuxt ${test}`,
"theme_color": "#ffffff",
"icons": [{"src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png"}, {
"src": "/pwa-512x512.png",
"sizes": "512x512",
"type": "image/png"
}, {"src": "/maskable-icon.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable"}]
}
})
[!NOTE]
Changing the title is only for poc. It is more of a usecase to change colors, locale or images
I think it would be a nice feature to have the possibility to keep at least some keys of the manifest file dynamic to get them from an api for example. One use case would be to change the app icon without having to create a new build.
As a proof of concept I wrote a module with a server handler that can return a manifest. (and replaced hrefs from
manifest.webmanifest
to mymanifest
routeresult: next try:
might solve: #104