-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eleventy.js
38 lines (30 loc) · 959 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
const Nunjucks = require("nunjucks");
const path = require("path");
module.exports = function (eleventyConfig) {
eleventyConfig.setTemplateFormats(["njk", "md"]);
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/files");
const nunjucksEnvironment = new Nunjucks.Environment(
new Nunjucks.FileSystemLoader([
"src",
path.join(
path.dirname(require.resolve("nhsuk-frontend/package.json")),
"packages/components"
),
])
);
nunjucksEnvironment.addFilter("isArray", (something) =>
Array.isArray(something)
);
eleventyConfig.setLibrary("njk", nunjucksEnvironment);
eleventyConfig.htmlTemplateEngine = "njk";
eleventyConfig.markdownTemplateEngine = "njk";
eleventyConfig.dir = {
output: "dist",
input: "src",
layouts: "_layouts",
includes: "_includes",
};
eleventyConfig.pathPrefix = "/nhs111-resources";
return eleventyConfig;
};