|
48 | 48 | </ServiceWorkerPreCacheGeneratedFiles>
|
49 | 49 |
|
50 | 50 | <!-- Setup the declarations for the Service Worker -->
|
51 |
| - <ServiceWorkerConstants Condition="'$(ServiceWorkerConstants)' == ''"> |
| 51 | + <ServiceWorkerConstants Condition="'$(ServiceWorkerConstants)' == '' AND '$(BlazorProjectType)' == 'CSB'"> |
52 | 52 | const baseURL = '$(ServiceWorkerBaseURL)'%3B;
|
53 |
| - const indexURL = '$(ServiceWorkerBaseUrl)$(ServiceWorkerIndexURL)'%3B; |
| 53 | + const indexURL = '$(ServiceWorkerBaseUrl)$(ProjectIndexPage)'%3B; |
54 | 54 | const networkFetchEvent = '$(ServiceWorkerNetworkFetchEvent)'%3B;
|
55 | 55 | const swInstallEvent = '$(ServiceWorkerInstallEvent)'%3B;
|
56 | 56 | const swInstalledEvent = '$(ServiceWorkerInstalledEvent)'%3B;
|
57 | 57 | const swActivateEvent = '$(ServiceWorkerActivateEvent)'%3B;
|
58 | 58 | const staticCachePrefix = '$(ServiceWorkerCacheName)-v'%3B;
|
59 | 59 | const staticCacheName = '$(ServiceWorkerCacheName)-v$(ServiceWorkerCacheVersion)'%3B;
|
60 | 60 | </ServiceWorkerConstants>
|
| 61 | + |
| 62 | + <!-- Setup the declarations for the Service Worker --> |
| 63 | + <ServiceWorkerConstants Condition="'$(ServiceWorkerConstants)' == '' AND '$(BlazorProjectType)' == 'SSB'"> |
| 64 | + const baseURL = '$(ServiceWorkerBaseURL)'%3B; |
| 65 | + const indexURL = '$(ServiceWorkerBaseUrl)$(ProjectHomePage)'%3B; |
| 66 | + const networkFetchEvent = '$(ServiceWorkerNetworkFetchEvent)'%3B; |
| 67 | + const swInstallEvent = '$(ServiceWorkerInstallEvent)'%3B; |
| 68 | + const swInstalledEvent = '$(ServiceWorkerInstalledEvent)'%3B; |
| 69 | + const swActivateEvent = '$(ServiceWorkerActivateEvent)'%3B; |
| 70 | + </ServiceWorkerConstants> |
61 | 71 | </PropertyGroup>
|
62 | 72 |
|
63 | 73 | <!-- The "Templates" properties are used to define where to find templates for the service worker sections -->
|
|
69 | 79 | <!-- The file that contains template code for the network fetch event in the service worker -->
|
70 | 80 | <ServiceWorkerTemplateNetwork Condition="'$(ServiceWorkerTemplateNetwork)' == ''">$(ServiceWorkerTemplatePath)sw_$(ServiceWorkerNetworkFetchEvent)-$(ServiceWorkerPattern).template.js</ServiceWorkerTemplateNetwork>
|
71 | 81 | </PropertyGroup>
|
72 |
| - <Message Importance="high" Text="Exclude:;@(ServiceWorkerPreCacheExcludeFiles);@(ServiceWorkerPreCacheExcludeReleaseFiles);"/> |
| 82 | + |
73 | 83 | <ItemGroup>
|
74 | 84 | <!-- Build a list of files to pre-cache -->
|
75 | 85 | <DistFiles Include="$(ServiceWorkerPreCacheIncludeFiles);" />
|
|
92 | 102 | <WriteLinesToFile File="$(WWWRoot)$(ServiceWorkerFileName)"
|
93 | 103 | Overwrite="true"
|
94 | 104 | Lines="$(ServiceWorkerConstants)" />
|
95 |
| - <WriteLinesToFile File="$(WWWRoot)$(ServiceWorkerFileName)" |
| 105 | + <WriteLinesToFile Condition="'$(BlazorProjectType)' == 'CSB'" |
| 106 | + File="$(WWWRoot)$(ServiceWorkerFileName)" |
96 | 107 | Overwrite="false"
|
97 | 108 | Lines="const requiredFiles = [;@(DistFiles -> '"/%(RecursiveDir)%(FileName)%(Extension)"'->Replace('\','/'),',%0D%0A');]%3B;" />
|
98 |
| - <WriteLinesToFile File="$(WWWRoot)$(ServiceWorkerFileName)" |
| 109 | + <WriteLinesToFile Condition="'$(BlazorProjectType)' == 'CSB'" |
| 110 | + File="$(WWWRoot)$(ServiceWorkerFileName)" |
99 | 111 | Overwrite="false"
|
100 | 112 | Lines="@(InstallTemplateLines);" />
|
101 | 113 | <WriteLinesToFile File="$(WWWRoot)$(ServiceWorkerFileName)"
|
|
0 commit comments