generated from fluid-project/trivet-monolingual
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheleventy.config.js
More file actions
101 lines (85 loc) · 3.09 KB
/
eleventy.config.js
File metadata and controls
101 lines (85 loc) · 3.09 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
Copyright the Weavly copyright holders.
See the AUTHORS.md file at the top-level directory of this distribution and at
https://github.com/codelearncreate/co-design/raw/main/AUTHORS.md.
Licensed under the New BSD license. You may not use this file except in compliance with this License.
You may obtain a copy of the New BSD License at
https://github.com/codelearncreate/co-design/raw/main/LICENSE.md.
*/
"use strict";
const fluidPlugin = require("eleventy-plugin-fluid");
const navigationPlugin = require("@11ty/eleventy-navigation");
// Import transforms
const parseTransform = require("./src/_transforms/parse-transform.js");
// Import data files
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
// Transforms
eleventyConfig.addTransform("parse", parseTransform);
// Passthrough copy
eleventyConfig.addPassthroughCopy({
"src/admin/config.yml": "admin/config.yml"
});
eleventyConfig.addPassthroughCopy({ "src/assets/icons": "/" });
eleventyConfig.addPassthroughCopy({ "src/assets/images": "assets/images" });
eleventyConfig.addPassthroughCopy({ "src/assets/uploads": "assets/uploads" });
// Custom collections
eleventyConfig.addCollection("pages", (collection) => {
return collection.getFilteredByGlob("./src/collections/pages/*.md");
});
eleventyConfig.addCollection("planning", (collection) => {
return collection
.getFilteredByGlob("./src/collections/guides/*.md")
.filter(function (item) {
return item.data.category === "planning";
})
.sort((a, b) => {
return a.data.order - b.data.order;
});
});
eleventyConfig.addCollection("doing", (collection) => {
return collection
.getFilteredByGlob("./src/collections/guides/*.md")
.filter(function (item) {
return item.data.category === "doing";
})
.sort((a, b) => {
return a.data.order - b.data.order;
});
});
eleventyConfig.addCollection("reflecting", (collection) => {
return collection
.getFilteredByGlob("./src/collections/guides/*.md")
.filter(function (item) {
return item.data.category === "reflecting";
})
.sort((a, b) => {
return a.data.order - b.data.order;
});
});
// Plugins
eleventyConfig.addPlugin(fluidPlugin, {
defaultLanguage: "en-CA",
css: {
enabled: false
},
sass: {
enabled: true
},
i18n: false
});
eleventyConfig.addPlugin(navigationPlugin);
// Shortcodes
eleventyConfig.addShortcode("svgPlaceholder", function (width, height) {
return `<svg viewBox="0 0 ${width} ${height}" style="--width: ${width}px;" class="placeholder">
<rect width="${width}" height="${height}" />
</svg>`;
});
return {
dir: {
input: "src"
},
passthroughFileCopy: true,
markdownTemplateEngine: "njk"
};
};