1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-22 15:42:38 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Cotes Chung
b3005f4e1a chore(release): 6.2.1 2023-09-11 00:36:52 +08:00
Cotes Chung
14d3960ca0 Merge branch 'hotfix/6.2.1' into production 2023-09-11 00:36:50 +08:00
Cotes Chung
4da7406dfe fix(pwa): installation failure caused by outdated cache entries
Change `/assets/css/style.css` to `/assets/css/jekyll-theme-chirpy.css`
2023-09-11 00:35:56 +08:00
Cotes Chung
1a041e0443 style(pwa): use 2 spaces indentation for sw.js and swcache.js 2023-09-11 00:30:23 +08:00
5 changed files with 92 additions and 88 deletions

View File

@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [6.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.2.0...v6.2.1) (2023-09-10)
### Bug Fixes
* **pwa:** installation failure caused by outdated cache entries ([4da7406](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4da7406dfea112a4a2b1db5615ecf2672be6694f))
## [6.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.1.0...v6.2.0) (2023-09-10) ## [6.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.1.0...v6.2.0) (2023-09-10)
### Features ### Features

View File

@@ -1,12 +1,11 @@
--- ---
layout: compress layout: compress
# The list to be cached by PWA # The list to be cached by PWA
--- ---
const resource = [ const resource = [
/* --- CSS --- */ /* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}', '{{ "/assets/css/:THEME.css" | replace: ':THEME', site.theme | relative_url }}',
/* --- PWA --- */ /* --- PWA --- */
'{{ "/app.js" | relative_url }}', '{{ "/app.js" | relative_url }}',

View File

@@ -28,19 +28,19 @@ function isExcluded(url) {
return false; return false;
} }
self.addEventListener('install', event => { self.addEventListener('install', (event) => {
event.waitUntil( event.waitUntil(
caches.open(cacheName).then(cache => { caches.open(cacheName).then((cache) => {
return cache.addAll(resource); return cache.addAll(resource);
}) })
); );
}); });
self.addEventListener('activate', event => { self.addEventListener('activate', (event) => {
event.waitUntil( event.waitUntil(
caches.keys().then(keyList => { caches.keys().then((keyList) => {
return Promise.all( return Promise.all(
keyList.map(key => { keyList.map((key) => {
if (key !== cacheName) { if (key !== cacheName) {
return caches.delete(key); return caches.delete(key);
} }
@@ -56,28 +56,28 @@ self.addEventListener('message', (event) => {
} }
}); });
self.addEventListener('fetch', event => { self.addEventListener('fetch', (event) => {
event.respondWith( event.respondWith(
caches.match(event.request).then(response => { caches.match(event.request).then((response) => {
if (response) { if (response) {
return response; return response;
} }
return fetch(event.request).then(response => { return fetch(event.request).then((response) => {
const url = event.request.url; const url = event.request.url;
if (event.request.method !== 'GET' || if (
event.request.method !== 'GET' ||
!verifyDomain(url) || !verifyDomain(url) ||
isExcluded(url)) { isExcluded(url)
) {
return response; return response;
} }
/* /* see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests> */
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
*/
let responseToCache = response.clone(); let responseToCache = response.clone();
caches.open(cacheName).then(cache => { caches.open(cacheName).then((cache) => {
/* console.log('[sw] Caching new resource: ' + event.request.url); */ /* console.log('[sw] Caching new resource: ' + event.request.url); */
cache.put(event.request, responseToCache); cache.put(event.request, responseToCache);
}); });
@@ -87,4 +87,3 @@ self.addEventListener('fetch', event => {
}) })
); );
}); });

View File

@@ -2,7 +2,7 @@
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy" spec.name = "jekyll-theme-chirpy"
spec.version = "6.2.0" spec.version = "6.2.1"
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]

View File

@@ -1,6 +1,6 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "6.2.0", "version": "6.2.1",
"description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.", "description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.",
"repository": { "repository": {
"type": "git", "type": "git",