-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
35 lines (30 loc) · 941 Bytes
/
.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
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("./src/css/");
eleventyConfig.addPassthroughCopy("./src/images/");
eleventyConfig.addPassthroughCopy("./src/js/");
eleventyConfig.addWatchTarget("./src/css/");
eleventyConfig.addWatchTarget("./src/images/");
eleventyConfig.addWatchTarget("./src/js/");
eleventyConfig.addNunjucksFilter('joinData', (arr = []) => {
try {
return arr
.map((str) => str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()))
.join(', ')
} catch (error) {
return ''
}
});
// Sort by filter function.
function sortByOrder(values) {
let vals = [...values]
return vals.sort((a, b) => Math.sign(a.data.order - b.data.order))
}
// Add the filter.
eleventyConfig.addFilter('sortByOrder', sortByOrder);
return {
dir: {
input: "src",
output: "public",
}
}
}