-
Notifications
You must be signed in to change notification settings - Fork 44
/
.eleventy.js
40 lines (32 loc) · 896 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
36
37
38
39
40
module.exports = function(config) {
// Add a date formatter filter to Nunjucks
config.addFilter("dateDisplay", require("./src/filters/dates.js") );
// More useful markdown inclusions
const markdownIt = require("markdown-it");
const md = new markdownIt({
html: true
});
config.addFilter("markdown", (content) => {
return md.render(content);
});
const Terser = require("terser");
config.addFilter("jsmin", function(code) {
let minified = Terser.minify(code);
if( minified.error ) {
console.log("Terser error: ", minified.error);
return code;
}
return minified.code;
});
// eleventy config settings
return {
dir: {
input: "src/site",
output: "dist",
includes: "_includes"
},
templateFormats : ["njk", "md"],
htmlTemplateEngine : "njk",
markdownTemplateEngine : "njk"
};
};