generated from philhawksworth/eleventail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
57 lines (46 loc) · 1.62 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const { DateTime } = require('luxon');
const util = require('util');
module.exports = function(eleventyConfig) {
// Layout aliases for convenience
eleventyConfig.addLayoutAlias('default', 'layouts/base.njk');
eleventyConfig.addLayoutAlias('conf', 'layouts/conf.njk');
eleventyConfig.addLayoutAlias('readings-text', 'layouts/readings-text.njk');
// a debug utility
eleventyConfig.addFilter('dump', obj => {
return util.inspect(obj)
});
// Date helpers
eleventyConfig.addFilter('readableDate', dateObj => {
return DateTime.fromJSDate(dateObj, {
zone: 'utc'
}).toFormat('LLLL d, y');
});
eleventyConfig.addFilter('htmlDate', dateObj => {
return DateTime.fromJSDate(dateObj, {
zone: 'utc'
}).toFormat('y-MM-dd');
});
// Grab excerpts and sections from a file
eleventyConfig.addFilter("section", require("./src/utils/section.js") );
// compress and combine js files
eleventyConfig.addFilter("jsmin", require("./src/utils/minify-js.js") );
// minify the html output when running in prod
if (process.env.NODE_ENV == "production") {
eleventyConfig.addTransform("htmlmin", require("./src/utils/minify-html.js") );
}
// Static assets to pass through
eleventyConfig.addPassthroughCopy("./src/site/fonts");
eleventyConfig.addPassthroughCopy("./src/site/images");
eleventyConfig.addPassthroughCopy("./src/site/css");
return {
dir: {
input: "src/site",
includes: "_includes",
output: "dist"
},
passthroughFileCopy: true,
templateFormats : ["njk", "md"],
htmlTemplateEngine : "njk",
markdownTemplateEngine : "njk",
};
};