-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy patheleventy.config.cjs
48 lines (40 loc) · 1.25 KB
/
eleventy.config.cjs
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
const pluginWebc = require("@11ty/eleventy-plugin-webc");
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { eleventyImagePlugin } = require("@11ty/eleventy-img");
const emojiShortName = require("emoji-short-name");
const {parseHTML} = require("linkedom");
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
module.exports = function(eleventyConfig) {
eleventyConfig.ignores.add("./README.md");
eleventyConfig.addWatchTarget("./_components/**/*.css");
eleventyConfig.addPlugin(pluginSyntaxHighlight, {
preAttributes: {
"tabindex": "0"
}
});
eleventyConfig.addPlugin(pluginWebc, {
components: [
"./_components/**/*.webc",
"npm:@11ty/eleventy-img/*.webc",
"npm:@11ty/is-land/*.webc"
]
});
eleventyConfig.addPlugin(eleventyImagePlugin, {
formats: ["webp", "jpeg"],
urlPath: "/img/",
defaultAttributes: {
loading: "lazy",
decoding: "async"
}
});
eleventyConfig.setServerOptions({
domDiff: false
});
eleventyConfig.addJavaScriptFunction("emojiShortName", (emoji) => {
return emojiShortName[emoji];
})
eleventyConfig.addJavaScriptFunction("selectFromHtml", (html, selector) => {
const { document } = parseHTML(html);
return document.querySelectorAll(selector);
});
};