-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
52 lines (46 loc) · 1.63 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
const fs = require("fs");
module.exports = function (eleventyConfig) {
/* ==================================================================
Enable static passthrough
================================================================== */
eleventyConfig.addPassthroughCopy({ "src/_static/": "/" });
/* ==================================================================
Override Browsersync defaults (used only with --serve)
================================================================== */
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
const content_404 = fs.readFileSync("dist/404.html");
browserSync.addMiddleware("*", (req, res) => {
// Provides the 404 content without redirect.
res.writeHead(404, { "Content-Type": "text/html; charset=UTF-8" });
res.write(content_404);
res.end();
});
},
},
ui: false,
ghostMode: false,
});
/* ==================================================================
RETURN
================================================================== */
return {
// Control which files Eleventy will process
// e.g.: *.md, *.njk, *.html, *.liquid
templateFormats: ["md", "njk", "html", "liquid"],
// Pre-process *.md files with:
markdownTemplateEngine: "njk",
// Pre-process *.html files with:
htmlTemplateEngine: "njk",
// Opt-out of pre-processing global data JSON files:
dataTemplateEngine: false,
// Set directories
dir: {
input: "src",
includes: "_includes",
data: "_data",
output: "dist",
},
};
};;