1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Improve the SW cache list

This commit is contained in:
Cotes Chung
2022-02-03 01:31:53 +08:00
parent 7a392510e6
commit 2c5e67f02b
3 changed files with 22 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
---
layout: compress
swcache: true
---
[

View File

@@ -9,13 +9,7 @@ const resource = [
/* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}',
/* --- JavaScripts --- */
{% 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',
/* --- PWA --- */
'{{ "/app.js" | relative_url }}',
'{{ "/sw.js" | relative_url }}',
@@ -26,18 +20,11 @@ const resource = [
'{{ tab.url | relative_url }}',
{% endfor %}
/* --- Favicons --- */
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
'{{ favicon_path }}/android-chrome-192x192.png',
'{{ favicon_path }}/android-chrome-512x512.png',
'{{ 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'
/* --- Favicons & compressed JS --- */
{% assign cache_list = site.static_files | where: 'swcache', true %}
{% for file in cache_list %}
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
{% endfor %}
];
@@ -50,6 +37,10 @@ const allowedDomains = [
'{{ 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.googleapis.com',
'cdn.jsdelivr.net',