generated from enatario/eleventy-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
39 lines (35 loc) · 1.05 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
module.exports = function(eleventyConfig) {
eleventyConfig.addWatchTarget("./src/css/");
eleventyConfig.addWatchTarget("./src/js/");
eleventyConfig.addPassthroughCopy("./src/static");
eleventyConfig.addFilter("keys", obj => Object.keys(obj));
eleventyConfig.addFilter("except", (arr=[]) => {
return arr.filter(function(value) {
return value != "all";
}).sort();
});
eleventyConfig.addNunjucksFilter("romanize", function(num) {
if (isNaN(num)) return NaN;
var digits = String(+num).split(""),
key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
"","I","II","III","IV","V","VI","VII","VIII","IX"],
roman = "",
i = 3;
while (i--) {
roman = (key[+digits.pop() + (i * 10)] || "") + roman;
}
return Array(+digits.join("") + 1).join("M") + roman;
});
return {
templateFormats: [
"md",
"njk"
],
dir: {
input: "src",
output: "dist"
},
markdownTemplateEngine: "njk"
}
}