forked from Bullrich/reveal-eleventy-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
39 lines (33 loc) · 1.21 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
const path = require("path");
const prettier = require("prettier");
module.exports = (config) => {
// This enable all the dependency libraries inside the `assets` folder
config.addPassthroughCopy({
"node_modules/reveal.js/dist": "assets/reveal/",
"node_modules/reveal.js/plugin": "assets/reveal/plugin",
});
// This copies anything from `src/images` into `dist/images`.
// Call it using <img src="images/my-image.jpg" />
config.addPassthroughCopy("./src/images/");
// Prettifies the output html so the indentations are correct
config.addTransform("prettier", function (content, outputPath) {
const extname = path.extname(outputPath);
switch (extname) {
case ".html":
// Strip leading period from extension and use as the Prettier parser.
const parser = extname.replace(/^./, "");
return prettier.format(content, { parser });
default:
return content;
}
});
return {
markdownTemplateEngine: "njk",
dataTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dir: {
input: "src",
output: "dist",
},
};
};