Generate webmanifest images
See original GitHub issueI’m trying to use this plugin to generate a favicon and webmanifest icons and I come to this working solution:
First of all I import the icon in different sizes without using the import result anywhere (so the icons will get generated in different sizes):
---
import Favicon from '../assets/logo.png?w=64&format=ico';
import Icon48 from '../assets/logo.png?w=48&format=png';
import Icon72 from '../assets/logo.png?w=72&format=png';
import Icon96 from '../assets/logo.png?w=96&format=png';
import Icon144 from '../assets/logo.png?w=144&format=png';
import Icon168 from '../assets/logo.png?w=168&format=png';
import Icon192 from '../assets/logo.png?w=192&format=png';
---
<html lang={locale}>
<head>
....
<link rel="manifest" href="manifest.webmanifest" />
<link rel="icon" type="image/x-icon" href={Favicon} />
</head>
<body>
...
</body>
</html>
Then I get the filename from the filesystem and use it in the (static) manifest.webmanifest file:
{
...
"icons": [{
"src": "/assets/logo@48w.2106fe6c.png",
"sizes": "48x48",
"type": "image/png"
}, {
"src": "/assets/logo@72w.c4bb68f4.png",
"sizes": "72x72",
"type": "image/png"
}, {
"src": "/assets/logo@96w.d28bed5c.png",
"sizes": "96x96",
"type": "image/png"
}, {
"src": "/assets/logo@144w.f094205f.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "/assets/logo@168w.0a076ecc.png",
"sizes": "168x168",
"type": "image/png"
}, {
"src": "/assets/logo@192w.e25558fa.png",
"sizes": "192x192",
"type": "image/png"
}]
}
This is working pretty good, however it would be nice to inject the asset path instead of copying it to the static webmanifest ifle. As far as I see, astro does not support any static generated non-html routes, otherwise it would be very easy to just create a manifest.webmanifest.astro page and generate it here
Does anyone have an idea, how to create webmanifest icon paths more easily?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
PWA Manifest Generator - SimiCart
PWA Manifest Generator. Automatically generate a fully functional web app manifest along with size-optimized icons for your PWA.
Read more >App Manifest Generator
Generate Icons. The Web App Manifest allows for specifying icons of varying sizes. Upload a 512x512 image for the icon and we'll generate...
Read more >web-app-manifest generator
Generate your manifest.json file and required icons easily using this app.
Read more >Web App Manifest Generator
Web App Manifests are one of the key pieces to making your web app look and feel like a native app. Learn more....
Read more >Web App Manifest generator for best site performances
Web App Manifest generator to make your website more competitive: tell the ... Specifies an array of image objects that can serve as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah cool! I tried this some days ago, back than it was only working with the node server running. I will check it out with the newest beta build. I also checked the release notes but did not found any hint that this will work.
@franzwilding closing this issue now. Feel free to comment on this issue or ask in the Discord channel if you are facing any kind of problems related to Astro.