Skip to content

Commit 79e3ab9

Browse files
Add manifest
1 parent dda2211 commit 79e3ab9

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/.template.config/template.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878
{
7979
"condition": "(!PWA)",
8080
"exclude": [
81-
"Client/wwwroot/service-worker*.js"
81+
"Client/wwwroot/service-worker*.js",
82+
"Client/wwwroot/manifest.json",
83+
"Client/wwwroot/icon-512.png"
8284
]
8385
}
8486
]

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/Client/wwwroot/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<base href="/" />
99
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
1010
<link href="css/site.css" rel="stylesheet" />
11+
<!--#if PWA -->
12+
<link href="manifest.json" rel="manifest" />
13+
<!--#endif -->
1114
</head>
1215

1316
<body>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "BlazorWasm-CSharp",
3+
"short_name": "BlazorWasm-CSharp",
4+
"start_url": "/",
5+
"display": "standalone",
6+
"background_color": "#ffffff",
7+
"theme_color": "#03173d",
8+
"icons": [
9+
{
10+
"src": "icon-512.png",
11+
"type": "image/png",
12+
"sizes": "512x512"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
// See service-worker.published.js for the offline support logic.
2-
// This is not enabled in development as it would make development more difficult
3-
// (changes would not be reflected on the first load after each change).
2+
3+
// In development, always fetch from the network and do not enable offline support.
4+
// This is because caching would make development more difficult (changes would not
5+
// be reflected on the first load after each change).
6+
self.addEventListener('fetch', () => { });

src/ProjectTemplates/BlazorWasm.ProjectTemplates/content/BlazorWasm-CSharp/Client/wwwroot/service-worker.published.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
const resourcesAvailableOffline = [
99
'index.html',
10+
'manifest.json',
11+
'icon-512.png',
1012
'_framework/blazor.boot.json',
1113
'_framework/blazor.webassembly.js',
1214
'_framework/wasm/dotnet.js',

0 commit comments

Comments
 (0)