This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
62 lines (55 loc) · 1.5 KB
/
.eleventy.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
const CleanCSS = require("clean-css");
const { DateTime } = require("luxon");
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const slugify = (str) =>
str
.toLowerCase()
.replace(/[^\w\s]|_/g, "")
.replace(/\s+/g, "-");
module.exports = function (conf) {
conf.addFilter("cssmin", (code) => new CleanCSS({}).minify(code).styles);
conf.addShortcode("slugify", (str = "") => slugify(str));
conf.addShortcode("dateFormat", (dateStr, frmt = "DDD 'at' t ZZZZ") =>
DateTime.fromISO(dateStr, { zone: "America/New_York" }).toFormat(frmt)
);
conf.addShortcode("headingAnchor", (level, text, id) => {
const finalId = id ? id : slugify(text);
return `<h${level} id="${finalId}">
<a class="header-anchor" href="#${finalId}" aria-label="Anchor link to ${text}">#</a>
${text}
</h${level}>`;
});
conf.setTemplateFormats([
"html",
"md",
"njk",
"gif",
"jpg",
"png",
"webp",
"svg",
"ttf",
"woff",
"woff2",
"ico",
]);
conf.addPassthroughCopy("./src/manifest.webmanifest");
conf.addPassthroughCopy("./src/ZOOM_verify_hks4cbEcQjOTBBL81dsu2Q.html");
conf.addWatchTarget("./src/**/*.css");
conf.addWatchTarget("./src/**/*.js");
conf.setLibrary(
"md",
markdownIt({ html: true }).use(markdownItAnchor, {
permalink: true,
permalinkBefore: true,
permalinkSymbol: "#",
})
);
return {
dir: {
input: "src",
output: "dist",
},
};
};