-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
37 lines (30 loc) · 1023 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
const { format } = require("date-fns/format");
const metadata = require("./src/_data/metadata.json");
const paths = {
input: "src",
output: process.env.npm_package_config_outdir,
};
module.exports = function (eleventyConfig) {
eleventyConfig.setTemplateFormats(["njk", "md", "html"]);
eleventyConfig.addPassthroughCopy("./src/assets/fonts");
eleventyConfig.addPassthroughCopy("./src/assets/js");
eleventyConfig.addPassthroughCopy("./src/assets/**/*.png");
eleventyConfig.addFilter("title", (title) =>
title ? metadata.title + " - " + title : metadata.title,
);
eleventyConfig.addFilter("date", function (date, formatFunction) {
return format(date, formatFunction);
});
eleventyConfig.addFilter(
"description",
(description) => description || metadata.description,
);
eleventyConfig.addWatchTarget("src/assets/js/**/*.js");
eleventyConfig.addWatchTarget("src/assets/css/**/*.css");
return {
dir: {
input: paths.input,
output: paths.output,
},
};
};