Skip to content

Commit d0701e1

Browse files
committed
feat: PWA support for the website
Signetd-off-by: Farhaan Bukhsh <[email protected]>
1 parent 281324a commit d0701e1

File tree

9 files changed

+78
-0
lines changed

9 files changed

+78
-0
lines changed

src/_includes/footer.njk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,11 @@
5353
<img src="{{ env.baseUrl }}img/logo.png" alt="PYCON 2025" class="w-[150px] sm:w-[350px] lg:w-[500px] pb-64 lg:pb-16 xl:pb-16 md:mr-30 xl:mr-50 transition-transform duration-100" style="animation: floating-logo 2s ease-in-out infinite;"/>
5454
</div>
5555
</footer>
56+
57+
<script>
58+
if ('serviceWorker' in navigator) {
59+
navigator.serviceWorker.register('{{ env.baseUrl }}js/service-worker.js')
60+
.then(() => console.log('SW registered'))
61+
.catch(console.error);
62+
}
63+
</script>

src/_includes/head.njk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<link rel="icon" type="image/x-icon" href="{{ env.baseUrl }}img/logo.png">
66
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
77
<link href="https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Hanken+Grotesk&display=swap" rel="stylesheet">
8+
<link rel="manifest" href="{{ env.baseUrl }}manifest.webmanifest">
9+
<meta name="theme-color" content="#4E62F5">
810
<!-- PRELOAD CDN SCRIPTS -->
911
<link rel="preconnect" href="https://unpkg.com/popper.js@1" as="script">
1012
<link rel="preconnect" href="https://unpkg.com/tippy.js@4" as="script">
15.7 KB
Loading

src/static/img/icons/icon-144.png

15.7 KB
Loading

src/static/img/icons/icon-192.png

21.1 KB
Loading
144 KB
Loading

src/static/img/icons/icon-512.png

59.8 KB
Loading

src/static/js/service-worker.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
const CACHE_NAME = 'inpycon2025-cache-v1';
3+
const assetsToCache = [
4+
'/',
5+
'/index.html',
6+
// include other HTML pages, CSS, JS, icons
7+
'/img/icon/icon_192.png',
8+
'/img/icon/icon_512.png'
9+
];
10+
11+
self.addEventListener('install', ev => {
12+
ev.waitUntil(
13+
caches.open(CACHE_NAME).then(cache => cache.addAll(assetsToCache))
14+
);
15+
self.skipWaiting();
16+
});
17+
18+
self.addEventListener('activate', ev => {
19+
ev.waitUntil(self.clients.claim());
20+
});
21+
22+
self.addEventListener('fetch', ev => {
23+
ev.respondWith(
24+
caches.match(ev.request).then(resp => resp || fetch(ev.request))
25+
);
26+
});

src/static/manifest.webmanifest

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
{
3+
"name": "PyCon India 2025",
4+
"short_name": "PyConIndia",
5+
"start_url": "/",
6+
"display": "standalone",
7+
"background_color": "#ffffff",
8+
"theme_color": "#4E62F5",
9+
"orientation": "portrait-primary",
10+
"icons": [
11+
{
12+
"src": "/img/icons/icon-192.png",
13+
"sizes": "192x192",
14+
"type": "image/png",
15+
"purpose": "any"
16+
},
17+
{
18+
"src": "/img/icons/icon-512.png",
19+
"sizes": "512x512",
20+
"type": "image/png",
21+
"purpose": "any"
22+
},
23+
{
24+
"src": "/img/icons/icon-144.png",
25+
"sizes": "144x144",
26+
"type": "image/png",
27+
"purpose": "any"
28+
},
29+
{
30+
"src": "/img/icons/icon-512-maskable.png",
31+
"sizes": "512x512",
32+
"type": "image/png",
33+
"purpose": "maskable"
34+
},
35+
{
36+
"src": "/img/icons/icon-144-maskable.png",
37+
"sizes": "144x144",
38+
"type": "image/png",
39+
"purpose": "maskable"
40+
}
41+
]
42+
}

0 commit comments

Comments
 (0)