Skip to content

Commit 8f83450

Browse files
committed
Added PWA
1 parent eb4065f commit 8f83450

File tree

11 files changed

+16070
-8446
lines changed

11 files changed

+16070
-8446
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Developer experience first:
2626
- 🖱️ One click deployment with Vercel or Netlify (or manual deployment to any hosting services)
2727
- 🌈 Include a FREE minimalist theme
2828
- 💯 Maximize lighthouse score
29+
- 🧩 Progresive web App
2930

3031
Built-in feature from Next.js:
3132

@@ -39,6 +40,13 @@ Built-in feature from Next.js:
3940
- SEO-friendly
4041
- 🚀 Production-ready
4142

43+
### Getting things PWA ready
44+
45+
- Create the app [maskable](https://maskable.app/editor) icon
46+
- Generate the icons and [manifest.json](https://www.simicart.com/manifest-generator.html/) files
47+
- publish the app anywhere with [PWA Builder](https://www.pwabuilder.com/
48+
- Check the /layout/Meta for all metadata :)
49+
4250
### Requirements
4351

4452
- Node.js 14+ and npm

next.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ module.exports = withBundleAnalyzer({
1515
// You can remove `basePath` if you don't need it.
1616
reactStrictMode: true,
1717
});
18+
19+
const withPWA = require('next-pwa');
20+
21+
module.exports = withPWA({
22+
// ...before
23+
pwa: {
24+
dest: 'public',
25+
register: true,
26+
skipWaiting: true,
27+
},
28+
});

package-lock.json

Lines changed: 10462 additions & 4996 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"dependencies": {
2525
"next": "^12.1.0",
26+
"next-pwa": "^5.5.5",
2627
"next-seo": "^5.2.0",
2728
"react": "^17.0.2",
2829
"react-dom": "^17.0.2",

public/icon-192x192.png

7.56 KB
Loading

public/icon-256x256.png

15.3 KB
Loading

public/icon-384x384.png

19.2 KB
Loading

public/icon-512x512.png

31.5 KB
Loading

public/manifest.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"theme_color": "#4a90e2",
3+
"background_color": "#ffffff",
4+
"display": "browser",
5+
"scope": "/",
6+
"start_url": "/",
7+
"name": "typescript_next_template",
8+
"short_name": "typescript_next_template",
9+
"icons": [
10+
{
11+
"src": "/icon-192x192.png",
12+
"sizes": "192x192",
13+
"type": "image/png"
14+
},
15+
{
16+
"src": "/icon-256x256.png",
17+
"sizes": "256x256",
18+
"type": "image/png"
19+
},
20+
{
21+
"src": "/icon-384x384.png",
22+
"sizes": "384x384",
23+
"type": "image/png"
24+
},
25+
{
26+
"src": "/icon-512x512.png",
27+
"sizes": "512x512",
28+
"type": "image/png"
29+
},
30+
{
31+
"src": "/apple-touch-icon.png",
32+
"sizes": "192x1192",
33+
"type": "image/x-icon",
34+
"purpose": "maskable"
35+
}
36+
],
37+
"description": "typescript_next_template"
38+
}

src/layout/Meta.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,24 @@ const Meta = (props: IMetaProps) => {
1717
<>
1818
<Head>
1919
<meta charSet="UTF-8" key="charset" />
20+
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
2021
<meta
2122
name="viewport"
22-
content="width=device-width,initial-scale=1"
23+
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
2324
key="viewport"
2425
/>
2526
<link
2627
rel="apple-touch-icon"
2728
href={`${router.basePath}/apple-touch-icon.png`}
2829
key="apple"
2930
/>
30-
<link
31-
rel="icon"
32-
type="image/png"
33-
sizes="32x32"
34-
href={`${router.basePath}/favicon-32x32.png`}
35-
key="icon32"
36-
/>
37-
<link
38-
rel="icon"
39-
type="image/png"
40-
sizes="16x16"
41-
href={`${router.basePath}/favicon-16x16.png`}
42-
key="icon16"
31+
<meta
32+
name="typescript_next_template"
33+
content="typescript_next_template"
4334
/>
35+
<meta name="theme-color" content="#000" />
36+
<title>typescript_next_template</title>
37+
<link rel="manifest" href="/manifest.json" />
4438
<link
4539
rel="icon"
4640
href={`${router.basePath}/favicon.ico`}

0 commit comments

Comments
 (0)