Skip to content

Commit

Permalink
Action 修改 service-worker.js 根路径设置
Browse files Browse the repository at this point in the history
修复 app.css 导入问题
  • Loading branch information
wherewhere committed Jun 17, 2024
1 parent 8d87d86 commit c3381d2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ jobs:
run: dotnet publish -c:Release -o:public

# Changes the base-tag in index.html to match GitHub Pages repository subdirectory
- name: Change base-tag
- name: Change index.html base-tag
run: sed -i 's/<base href="\/" \/>/<base href="\/wherlog\/" \/>/g' public/wwwroot/index.html

# Changes the base in service-worker.js to match GitHub Pages repository subdirectory
- name: Change service-worker.js base
run: sed -i 's/const base = "\/";/const base = "\/wherlog\/";/g' public/wwwroot/service-worker.js

# Copy index.html to 404.html to serve the same file when a file is not found
- name: copy index.html to 404.html
run: cp public/wwwroot/index.html public/wwwroot/404.html
Expand Down
2 changes: 1 addition & 1 deletion Wherlog/wwwroot/css/app.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';
@import '../_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css';

body {
--body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion Wherlog/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<body>
<!-- Set the default theme ("mode" overrides the "storage-name") -->
<script src="js/loading-theme.js" type="text/javascript" async></script>
<script src="js/loading-theme.js" type="text/javascript"></script>
<loading-theme storage-name="theme"></loading-theme>
<!-- End -->

Expand Down
4 changes: 2 additions & 2 deletions Wherlog/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const base = "/";
const baseUrl = new URL(base, self.origin);
const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href);

async function onInstall(event) {
async function onInstall(_) {
console.info('Service worker: Install');

// Fetch and cache all matching items from the assets manifest
Expand All @@ -27,7 +27,7 @@ async function onInstall(event) {
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
}

async function onActivate(event) {
async function onActivate(_) {
console.info('Service worker: Activate');

// Delete unused caches
Expand Down

0 comments on commit c3381d2

Please sign in to comment.