generated from yukinissie/react-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from takatoshiinaoka/set-pwd
[add] VitePWA settings
- Loading branch information
Showing
12 changed files
with
1,838 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,3 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
.node-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# api | ||
|
||
Static Web Apps の API です。 | ||
|
||
## api のホットリロード | ||
|
||
オプション -w | ||
監視モードでコンパイラを実行します。 入力(input)ファイルを監視し、変更時に再コンパイルをトリガします。 | ||
|
||
``` | ||
"watch": "tsc -w" | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="ja"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>たてツイート</title> | ||
<style type="text/css"> | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
background: #00aff9; | ||
height: 100vh; | ||
margin: 0; | ||
color: white; | ||
} | ||
h1 { | ||
margin: 0.8em 3rem; | ||
font: 4em Roboto; | ||
} | ||
p { | ||
margin: 0.2em 3rem; | ||
font: 2em Roboto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>おっと!!!</h1> | ||
<p>このページはオフラインでは表示できません。</p> | ||
<p><a href="../index.html">ホームページに戻る </a></p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* index.html の script タグで参照しているファイル | ||
*/ | ||
const CACHE_NAME = 'version-1' | ||
const urlsToCache = ['index.html', 'offline.html'] | ||
|
||
// Install SW | ||
self.addEventListener('install', (event) => { | ||
event.waitUntil( | ||
caches.open(CACHE_NAME).then((cache) => { | ||
console.log('Opened cache') | ||
return cache.addAll(urlsToCache) | ||
}) | ||
) | ||
}) | ||
|
||
// Listen for requests | ||
self.addEventListener('fetch', (event) => { | ||
event.respondWith( | ||
caches.match(event.request).then(() => { | ||
return fetch(event.request).catch(() => caches.match('offline.html')) | ||
}) | ||
) | ||
}) | ||
|
||
// Activate the SW | ||
self.addEventListener('activate', (event) => { | ||
const casheWhitelist = [] | ||
casheWhitelist.push(CACHE_NAME) | ||
|
||
event.waitUntil( | ||
caches.keys().then((casheNames) => | ||
Promise.all( | ||
casheNames.map((casheName) => { | ||
if (!casheWhitelist.includes(casheName)) { | ||
return casheWhitelist.delete(casheName) | ||
} | ||
}) | ||
) | ||
) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.