Skip to content
This repository was archived by the owner on May 2, 2021. It is now read-only.

Commit 91c5dc4

Browse files
committed
manifest icons
1 parent 1c2eff2 commit 91c5dc4

16 files changed

+198
-16
lines changed

package-lock.json

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

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"serve": "eleventy --serve",
8-
"build": "eleventy"
8+
"build": "ELEVENTY_ENV=production eleventy"
99
},
1010
"repository": {
1111
"type": "git",
@@ -18,12 +18,17 @@
1818
"@11ty/eleventy": "^0.11.1",
1919
"@11ty/eleventy-img": "^0.6.0",
2020
"@11ty/eleventy-plugin-rss": "^1.0.7",
21+
"esbuild": "^0.8.28",
2122
"eslint": "^7.16.0",
2223
"eslint-config-prettier": "^7.1.0",
2324
"eslint-plugin-node": "^11.0.0",
2425
"eslint-plugin-prettier": "^3.1.2",
2526
"js-yaml": "^3.13.1",
2627
"luxon": "^1.22.0",
2728
"prettier": "^2.2.1"
29+
},
30+
"dependencies": {
31+
"workbox-routing": "^6.0.2",
32+
"workbox-strategies": "^6.0.2"
2833
}
2934
}

src/_includes/head.njk

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,14 @@
7979
{% endif %}
8080
</script>
8181
<!-- Icons -->
82-
<!-- TODO: ADD ICON FILES -->
83-
<!--<link rel="icon" href="/favicon32.png" sizes="32x32">-->
84-
<!--<link rel="icon" href="/favicon192.png" sizes="192x192">-->
85-
<!--<link rel="apple-touch-icon-precomposed" href="/favicon180.png">-->
86-
<!--<meta name="msapplication-TileImage" content="/favicon270.png">-->
82+
83+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
84+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
85+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
86+
<link rel="manifest" href="/manifest.json">
87+
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
88+
<meta name="msapplication-TileColor" content="#da532c">
89+
<meta name="theme-color" content="#ffffff">
8790

8891
<!-- CSS -->
8992
<link rel="preconnect" href="https://fonts.gstatic.com">

src/_js/.eslintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
4+
"env": {
5+
"browser": true
6+
},
7+
"parserOptions": {
8+
"ecmaVersion": 2020,
9+
"sourceType": "module"
10+
},
11+
"rules": {
12+
"no-console": 0,
13+
"no-shadow": "warn",
14+
"block-scoped-var": "error",
15+
"consistent-return": "error",
16+
"eqeqeq": "error"
17+
}
18+
}
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
/* eslint-disable no-undef */
22
const cacheName = 'fevr-v2-cache';
3-
4-
// import workbox
5-
importScripts(
6-
'https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js',
7-
);
8-
const { routing, strategies } = workbox;
3+
import { registerRoute } from 'workbox-routing';
4+
import { StaleWhileRevalidate, NetworkFirst } from 'workbox-strategies';
95

106
const listRegExp = /^\/(index\.html|eventi\/index\.html)/;
117

12-
routing.registerRoute(
8+
registerRoute(
139
({ url }) => !listRegExp.test(url.pathname),
14-
new strategies.StaleWhileRevalidate({ cacheName }),
10+
new StaleWhileRevalidate({ cacheName }),
1511
);
1612

17-
routing.registerRoute(
13+
registerRoute(
1814
({ url }) => listRegExp.test(url.pathname),
19-
new strategies.NetworkFirst({ cacheName: cacheName + '-list' }),
15+
new NetworkFirst({ cacheName: cacheName + '-list' }),
2016
);
2117

2218
// removes all caches not named <cacheName>

src/service-worker.11ty.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const { resolve } = require('path');
2+
const esbuild = require('esbuild');
3+
4+
const PRODUCTION = process.env.ELEVENTY_ENV === 'production';
5+
6+
module.exports = class Scripts {
7+
data() {
8+
return {
9+
permalink: '/service-worker.js',
10+
eleventyExcludeFromCollections: true,
11+
};
12+
}
13+
14+
async render() {
15+
const { outputFiles } = await esbuild.build({
16+
entryPoints: [resolve(__dirname, './_js/service-worker.js')],
17+
bundle: true,
18+
minify: PRODUCTION,
19+
sourcemap: false,
20+
target: ['es2019'],
21+
write: false,
22+
define: {
23+
'process.env.NODE_ENV': JSON.stringify(
24+
process.env.ELEVENTY_ENV || 'development',
25+
),
26+
},
27+
});
28+
return outputFiles[0].contents;
29+
}
30+
};

static/android-chrome-192x192.png

6.12 KB
Loading

static/android-chrome-512x512.png

17.7 KB
Loading

static/apple-touch-icon.png

5.94 KB
Loading

static/browserconfig.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<browserconfig>
3+
<msapplication>
4+
<tile>
5+
<square150x150logo src="/mstile-150x150.png"/>
6+
<TileColor>#da532c</TileColor>
7+
</tile>
8+
</msapplication>
9+
</browserconfig>

0 commit comments

Comments
 (0)