forked from ericwbailey/a11y-webring.club
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
51 lines (43 loc) · 1.41 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
// Plugins
const { EleventyRenderPlugin } = require("@11ty/eleventy");
module.exports = function(eleventyConfig) {
// Watch targets
eleventyConfig.addWatchTarget("./index.njk");
eleventyConfig.addWatchTarget("./includes/**/*.njk");
eleventyConfig.addWatchTarget("./site.css");
// Passthrough
eleventyConfig.addPassthroughCopy("robots.txt");
eleventyConfig.addPassthroughCopy("site.css");
eleventyConfig.addPassthroughCopy("texture.png");
eleventyConfig.addPassthroughCopy("apple-touch-icon.png");
eleventyConfig.addPassthroughCopy("avatar.png");
eleventyConfig.addPassthroughCopy("favicon.svg");
eleventyConfig.addPassthroughCopy("safari-pinned-tab.svg");
eleventyConfig.addPassthroughCopy("favicon.ico");
eleventyConfig.addPassthroughCopy("facebook.png");
eleventyConfig.addPassthroughCopy("twitter.png");
// Eleventy config
eleventyConfig.setQuietMode(true);
eleventyConfig.addPlugin(EleventyRenderPlugin);
// sortDataByDate - Sort by data files `date` field
eleventyConfig.addFilter("sortDataByDate", (obj) => {
const sorted = {};
Object.keys(obj)
.sort((a, b) => {
return obj[a].date > obj[b].date ? 1 : -1;
})
.forEach((name) => (sorted[name] = obj[name]));
return sorted;
});
return {
// Supported formats
templateFormats: [
"njk"
],
// Preprocess
htmlTemplateEngine: "njk",
dir: {
data: "data"
}
};
};