@@ -4,17 +4,18 @@ layout: compress
44# The list to be cached by PWA
55-- -
66
7- const include = [
8- /* --- CSS --- */
7+ const resource = [
98
9+ /* --- CSS --- */
1010 '{{ "/assets/css/style.css" | relative_url }}' ,
1111
12- /* --- Javascripts --- */
13- '{{ "/assets/js/dist/home.min.js" | relative_url }}' ,
14- '{{ "/assets/js/dist/page.min.js" | relative_url }}' ,
15- '{{ "/assets/js/dist/post.min.js" | relative_url }}' ,
16- '{{ "/assets/js/dist/categories.min.js" | relative_url }}' ,
17- '{{ "/assets/js/data/search.json" | relative_url }}' ,
12+ /* --- JavaScripts --- */
13+ { % assign js_path = "/assets/js" | relative_url % }
14+ '{{ js_path }}/dist/home.min.js' ,
15+ '{{ js_path }}/dist/page.min.js' ,
16+ '{{ js_path }}/dist/post.min.js' ,
17+ '{{ js_path }}/dist/categories.min.js' ,
18+ '{{ js_path }}/data/search.json' ,
1819 '{{ "/app.js" | relative_url }}' ,
1920 '{{ "/sw.js" | relative_url }}' ,
2021
@@ -25,12 +26,8 @@ const include = [
2526 '{{ tab.url }}' ,
2627 { % endfor % }
2728
28-
2929 /* --- Icons --- */
30-
31- { % - capture icon_url - % }
32- { { "/assets/img/favicons" | relative_url } }
33- { % - endcapture - % }
30+ { % assign icon_url = "/assets/img/favicons" | relative_url % }
3431 '{{ icon_url }}/favicon.ico' ,
3532 '{{ icon_url }}/apple-icon.png' ,
3633 '{{ icon_url }}/apple-icon-precomposed.png' ,
@@ -52,10 +49,24 @@ const include = [
5249 '{{ icon_url }}/browserconfig.xml'
5350] ;
5451
55- const exclude = [
56- { % - if site . google_analytics . pv . proxy_endpoint - % }
57- 'https://{{ site.google_analytics.pv.proxy_endpoint | replace: "https://", "" | split: "/" | first }}' ,
58- { % - endif - % }
59- 'https://img.shields.io' ,
60- '/assets/js/data/pageviews.json'
52+ /* The request url with below domain will be cached */
53+ const allowedDomains = [
54+ { % if site . google_analytics . id != '' % }
55+ 'www.googletagmanager.com' ,
56+ 'www.google-analytics.com' ,
57+ { % endif % }
58+
59+ '{{ site.url | split: "//" | last }}' ,
60+
61+ 'fonts.gstatic.com' ,
62+ 'fonts.googleapis.com' ,
63+ 'cdn.jsdelivr.net' ,
64+ 'polyfill.io'
65+ ] ;
66+
67+ /* Requests that include the following path will be banned */
68+ const denyUrls = [
69+ { % if site . google_analytics . pv . cache_path % }
70+ '{{ site.google_analytics.pv.cache_path | absolute_url }}'
71+ { % endif % }
6172] ;
0 commit comments