Improve the SW cache list
This commit is contained in:
parent
7a392510e6
commit
2c5e67f02b
3 changed files with 22 additions and 25 deletions
17
_config.yml
17
_config.yml
|
@ -121,8 +121,7 @@ collections:
|
||||||
sort_by: order
|
sort_by: order
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
-
|
- scope:
|
||||||
scope:
|
|
||||||
path: '' # An empty string here means all files in the project
|
path: '' # An empty string here means all files in the project
|
||||||
type: posts
|
type: posts
|
||||||
values:
|
values:
|
||||||
|
@ -132,18 +131,24 @@ defaults:
|
||||||
# DO NOT modify the following parameter unless you are confident enough
|
# DO NOT modify the following parameter unless you are confident enough
|
||||||
# to update the code of all other post links in this project.
|
# to update the code of all other post links in this project.
|
||||||
permalink: /posts/:title/
|
permalink: /posts/:title/
|
||||||
-
|
- scope:
|
||||||
scope:
|
|
||||||
path: _drafts
|
path: _drafts
|
||||||
values:
|
values:
|
||||||
comments: false
|
comments: false
|
||||||
-
|
- scope:
|
||||||
scope:
|
|
||||||
path: ''
|
path: ''
|
||||||
type: tabs # see `site.collections`
|
type: tabs # see `site.collections`
|
||||||
values:
|
values:
|
||||||
layout: page
|
layout: page
|
||||||
permalink: /:title/
|
permalink: /:title/
|
||||||
|
- scope:
|
||||||
|
path: assets/img/favicons
|
||||||
|
values:
|
||||||
|
swcache: true
|
||||||
|
- scope:
|
||||||
|
path: assets/js/dist
|
||||||
|
values:
|
||||||
|
swcache: true
|
||||||
|
|
||||||
sass:
|
sass:
|
||||||
style: compressed
|
style: compressed
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
layout: compress
|
layout: compress
|
||||||
|
swcache: true
|
||||||
---
|
---
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
@ -9,13 +9,7 @@ const resource = [
|
||||||
/* --- CSS --- */
|
/* --- CSS --- */
|
||||||
'{{ "/assets/css/style.css" | relative_url }}',
|
'{{ "/assets/css/style.css" | relative_url }}',
|
||||||
|
|
||||||
/* --- JavaScripts --- */
|
/* --- PWA --- */
|
||||||
{% assign js_path = "/assets/js" | relative_url %}
|
|
||||||
'{{ js_path }}/dist/home.min.js',
|
|
||||||
'{{ js_path }}/dist/page.min.js',
|
|
||||||
'{{ js_path }}/dist/post.min.js',
|
|
||||||
'{{ js_path }}/dist/categories.min.js',
|
|
||||||
'{{ js_path }}/data/search.json',
|
|
||||||
'{{ "/app.js" | relative_url }}',
|
'{{ "/app.js" | relative_url }}',
|
||||||
'{{ "/sw.js" | relative_url }}',
|
'{{ "/sw.js" | relative_url }}',
|
||||||
|
|
||||||
|
@ -26,18 +20,11 @@ const resource = [
|
||||||
'{{ tab.url | relative_url }}',
|
'{{ tab.url | relative_url }}',
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
/* --- Favicons --- */
|
/* --- Favicons & compressed JS --- */
|
||||||
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
|
{% assign cache_list = site.static_files | where: 'swcache', true %}
|
||||||
|
{% for file in cache_list %}
|
||||||
'{{ favicon_path }}/android-chrome-192x192.png',
|
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
|
||||||
'{{ favicon_path }}/android-chrome-512x512.png',
|
{% endfor %}
|
||||||
'{{ favicon_path }}/apple-touch-icon.png',
|
|
||||||
'{{ favicon_path }}/favicon-16x16.png',
|
|
||||||
'{{ favicon_path }}/favicon-32x32.png',
|
|
||||||
'{{ favicon_path }}/favicon.ico',
|
|
||||||
'{{ favicon_path }}/mstile-150x150.png',
|
|
||||||
'{{ favicon_path }}/site.webmanifest',
|
|
||||||
'{{ favicon_path }}/browserconfig.xml'
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -50,6 +37,10 @@ const allowedDomains = [
|
||||||
|
|
||||||
'{{ site.url | split: "//" | last }}',
|
'{{ site.url | split: "//" | last }}',
|
||||||
|
|
||||||
|
{% if site.img_cdn contains '//' and site.img_cdn %}
|
||||||
|
'{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
'fonts.gstatic.com',
|
'fonts.gstatic.com',
|
||||||
'fonts.googleapis.com',
|
'fonts.googleapis.com',
|
||||||
'cdn.jsdelivr.net',
|
'cdn.jsdelivr.net',
|
||||||
|
|
Loading…
Reference in a new issue