Skip to content

Commit

Permalink
feat: Dynamically generate manifest JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
munen committed Sep 7, 2020
1 parent 3695179 commit 3566297
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
33 changes: 33 additions & 0 deletions public/index.html
Expand Up @@ -45,5 +45,38 @@
onreadystatechange="if (this.readyState === 'complete') this.onload()"
></script>
<div id="root"></div>
<script>
var {pathname} = window.location;

var manifest = {
"short_name": "organice",
"name": "organice",
"icons": [
{
"src": "organice-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "organice-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": pathname || "/index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

const manifestBlob = new Blob([JSON.stringify(manifest)], {type: 'application/json'});
const manifestURL = URL.createObjectURL(manifestBlob);
document.querySelector("link[rel='manifest']").setAttribute('href', manifestURL);
</script>
</body>
</html>
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

0 comments on commit 3566297

Please sign in to comment.