-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
75 lines (60 loc) · 2.13 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
63
64
65
66
67
68
69
70
71
72
73
74
75
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const markdownItPrism = require("markdown-it-prism");
const { eleventyImageTransformPlugin } = require("@11ty/eleventy-img");
const rss = require("@11ty/eleventy-plugin-rss");
const metagen = require("eleventy-plugin-metagen");
const EleventyVitePlugin = require("@11ty/eleventy-plugin-vite");
const activeSection = require("./src/_shortcodes/active-section");
const ariaCurrent = require("./src/_shortcodes/aria-current");
const availability = require("./src/_shortcodes/availability");
const { humanPostDate, isoPostDate } = require("./src/_filters/date");
module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("src/_filters");
eleventyConfig.addWatchTarget("src/_shortcodes");
eleventyConfig.addWatchTarget("src/_styles");
eleventyConfig.addShortcode("activeSection", activeSection);
eleventyConfig.addShortcode("ariaCurrent", ariaCurrent);
eleventyConfig.addShortcode("availability", availability);
eleventyConfig.addFilter("humanPostDate", humanPostDate);
eleventyConfig.addFilter("isoPostDate", isoPostDate);
eleventyConfig.addFilter("log", function (value) {
console.log(value);
});
eleventyConfig.addPlugin(rss);
eleventyConfig.addPlugin(metagen);
eleventyConfig.addPlugin(EleventyVitePlugin);
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
formats: ["avif", "webp", "jpeg"],
// widths: ["350", "700", "1000", "auto"],
widths: ["auto"],
defaultAttributes: {
loading: "lazy",
decoding: "async"
}
});
eleventyConfig.addPassthroughCopy({ "src/assets/public": "public" });
eleventyConfig.addPassthroughCopy("src/assets");
const mdLib = markdownIt({
html: true,
breaks: true,
linkify: true,
typographer: true,
})
.use(markdownItAnchor, {
tabIndex: false,
})
.use(markdownItPrism, {
defaultLanguage: "plain",
highlightInlineCode: true,
});
eleventyConfig.setLibrary("md", mdLib);
return {
markdownTemplateEngine: "njk",
dir: {
input: "src",
output: "dist",
layouts: "_layouts",
},
};
};