-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
41 lines (31 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
40
41
const { DateTime } = require("luxon");
module.exports = function(config) {
// A useful way to reference to the contect we are runing eleventy in
let env = process.env.ELEVENTY_ENV;
// Layout aliases can make templates more portable
config.addLayoutAlias('default', 'layouts/base.njk');
// Add some utiliuty filters
config.addFilter("squash", require("./src/filters/squash.js") );
config.addFilter("dateDisplay", (dateObj, format = "LLL d, y") => {
return DateTime.fromJSDate(dateObj, {
zone: "utc"
}).toFormat(format);
});
// minify the html output
config.addTransform("htmlmin", require("./src/utils/minify-html.js"));
// pass some assets right through
config.addPassthroughCopy("./src/site/images");
// make the seed target act like prod
env = (env=="seed") ? "prod" : env;
return {
dir: {
input: "src/site",
output: "dist",
data: `_data/${env}`
},
templateFormats : ["njk", "md"],
htmlTemplateEngine : "njk",
markdownTemplateEngine : "njk",
passthroughFileCopy: true
};
};