Skip to content

Commit 60ec7c9

Browse files
committed
refactor(workbox-build): remove useWith from Eta template configuration
1 parent 62b9d8b commit 60ec7c9

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

packages/workbox-build/src/lib/populate-sw-template.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {stringifyWithoutComments} from './stringify-without-comments';
1616
import {swTemplate} from '../templates/sw-template';
1717

1818
const eta = new Eta({
19-
useWith: true,
2019
autoEscape: false,
2120
})
2221

packages/workbox-build/src/templates/sw-template.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export const swTemplate = `/**
1818
* See https://goo.gl/2aRDsh
1919
*/
2020
21-
<% if (importScripts) { %>
21+
<% if (it.importScripts) { %>
2222
importScripts(
23-
<%= importScripts.map(JSON.stringify).join(',\\n ') %>
23+
<%= it.importScripts.map(JSON.stringify).join(',\\n ') %>
2424
);
2525
<% } %>
2626
27-
<% if (navigationPreload) { %><%= use('workbox-navigation-preload', 'enable') %>();<% } %>
27+
<% if (it.navigationPreload) { %><%= it.use('workbox-navigation-preload', 'enable') %>();<% } %>
2828
29-
<% if (cacheId) { %><%= use('workbox-core', 'setCacheNameDetails') %>({prefix: <%= JSON.stringify(cacheId) %>});<% } %>
29+
<% if (it.cacheId) { %><%= it.use('workbox-core', 'setCacheNameDetails') %>({prefix: <%= JSON.stringify(it.cacheId) %>});<% } %>
3030
31-
<% if (skipWaiting) { %>
31+
<% if (it.skipWaiting) { %>
3232
self.skipWaiting();
3333
<% } else { %>
3434
self.addEventListener('message', (event) => {
@@ -37,24 +37,24 @@ self.addEventListener('message', (event) => {
3737
}
3838
});
3939
<% } %>
40-
<% if (clientsClaim) { %><%= use('workbox-core', 'clientsClaim') %>();<% } %>
40+
<% if (it.clientsClaim) { %><%= it.use('workbox-core', 'clientsClaim') %>();<% } %>
4141
42-
<% if (Array.isArray(manifestEntries) && manifestEntries.length > 0) {%>
42+
<% if (Array.isArray(it.manifestEntries) && it.manifestEntries.length > 0) {%>
4343
/**
4444
* The precacheAndRoute() method efficiently caches and responds to
4545
* requests for URLs in the manifest.
4646
* See https://goo.gl/S9QRab
4747
*/
48-
<%= use('workbox-precaching', 'precacheAndRoute') %>(<%= JSON.stringify(manifestEntries, null, 2) %>, <%= precacheOptionsString %>);
49-
<% if (cleanupOutdatedCaches) { %><%= use('workbox-precaching', 'cleanupOutdatedCaches') %>();<% } %>
50-
<% if (navigateFallback) { %><%= use('workbox-routing', 'registerRoute') %>(new <%= use('workbox-routing', 'NavigationRoute') %>(<%= use('workbox-precaching', 'createHandlerBoundToURL') %>(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackAllowlist || navigateFallbackDenylist) { %>, {
51-
<% if (navigateFallbackAllowlist) { %>allowlist: [<%= navigateFallbackAllowlist %>],<% } %>
52-
<% if (navigateFallbackDenylist) { %>denylist: [<%= navigateFallbackDenylist %>],<% } %>
48+
<%= it.use('workbox-precaching', 'precacheAndRoute') %>(<%= JSON.stringify(it.manifestEntries, null, 2) %>, <%= it.precacheOptionsString %>);
49+
<% if (it.cleanupOutdatedCaches) { %><%= it.use('workbox-precaching', 'cleanupOutdatedCaches') %>();<% } %>
50+
<% if (it.navigateFallback) { %><%= it.use('workbox-routing', 'registerRoute') %>(new <%= it.use('workbox-routing', 'NavigationRoute') %>(<%= it.use('workbox-precaching', 'createHandlerBoundToURL') %>(<%= JSON.stringify(it.navigateFallback) %>)<% if (it.navigateFallbackAllowlist || it.navigateFallbackDenylist) { %>, {
51+
<% if (it.navigateFallbackAllowlist) { %>allowlist: [<%= it.navigateFallbackAllowlist %>],<% } %>
52+
<% if (it.navigateFallbackDenylist) { %>denylist: [<%= it.navigateFallbackDenylist %>],<% } %>
5353
}<% } %>));<% } %>
5454
<% } %>
5555
56-
<% if (runtimeCaching) { runtimeCaching.forEach(runtimeCachingString => {%><%= runtimeCachingString %><% });} %>
56+
<% if (it.runtimeCaching) { it.runtimeCaching.forEach(runtimeCachingString => {%><%= runtimeCachingString %><% });} %>
5757
58-
<% if (offlineAnalyticsConfigString) { %><%= use('workbox-google-analytics', 'initialize') %>(<%= offlineAnalyticsConfigString %>);<% } %>
58+
<% if (it.offlineAnalyticsConfigString) { %><%= it.use('workbox-google-analytics', 'initialize') %>(<%= it.offlineAnalyticsConfigString %>);<% } %>
5959
60-
<% if (disableDevLogs) { %>self.__WB_DISABLE_DEV_LOGS = true;<% } %>`;
60+
<% if (it.disableDevLogs) { %>self.__WB_DISABLE_DEV_LOGS = true;<% } %>`;

0 commit comments

Comments
 (0)