-
Notifications
You must be signed in to change notification settings - Fork 0
/
eleventy.config.js
77 lines (69 loc) · 2.38 KB
/
eleventy.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const path = require("node:path");
const process = require("node:process");
const icons = {
concepts: {
title: "Concepts",
description:
"Icons that represent common IndieWeb principles and ideas. These share the same ‘node’ motif used in the protocol icons.",
color: "ffb100",
icons: {
"personal-domain": { name: "Personal domain" },
pesos: { name: "PESOS" },
posse: { name: "POSSE" },
},
},
microformats: {
title: "Formats",
description:
"Icons that represent Microformats and its serialisations. These build on the existing Microformats identity.",
color: "a3cc00",
icons: {
microformats: { name: "Microformats" },
"h-card": { name: "h-card" },
"h-cite": { name: "h-cite" },
"h-entry": { name: "h-entry" },
"h-event": { name: "h-event" },
"h-feed": { name: "h-feed" },
"h-review": { name: "h-review" },
jf2: { name: "JF2" },
mf2: { name: "mf2" },
"rel-me": { name: "rel-me" },
},
},
protocols: {
title: "Protocols",
description:
"Icons that represent IndieWeb standards and protocols. These share the same ‘node’ motif used in the concept icons.",
icons: {
indieauth: { name: "IndieAuth", color: "cc0081" },
micropub: { name: "Micropub", color: "13b919" },
microsub: { name: "Microsub", color: "00ccb1" },
websub: { name: "WebSub", color: "6d00cc" },
webmention: { name: "Webmention", color: "ff5c00" },
salmention: { name: "Salmention", color: "ff5c00" },
vouch: { name: "Vouch", color: "ff5c00" },
},
},
};
module.exports = function (eleventyConfig) {
// Generate icons with color fill, useful when embedding as an `img`
eleventyConfig.addExtension("svg", {
compile: async (inputContent, inputPath) => {
const { dir, name } = path.parse(inputPath);
const category = dir.split("/")[2];
const icon = icons[category].icons[name];
const color = icon.color || icons[category].color;
let output = inputContent.replace("currentcolor", `#${color}`);
return async () => {
return output;
};
},
outputFileExtension: "svg",
});
eleventyConfig.addTemplateFormats("svg");
eleventyConfig.addGlobalData("icons", icons);
eleventyConfig.ignores.add("README.md");
return {
pathPrefix: process.env.GITHUB_ACTIONS ? "/indieweb-icons/" : "/",
};
};