-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eleventy.ts
More file actions
53 lines (46 loc) · 1.26 KB
/
.eleventy.ts
File metadata and controls
53 lines (46 loc) · 1.26 KB
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
import { UserConfig } from "@11ty/eleventy";
import { readFileSync } from "fs";
import { fileOpts } from "./11ty/misc";
export = (cfg: UserConfig) => {
// load the various packages that make up the site and its functionality
["events", "functions", "layouts", "libraries", "plugins", "transforms"].map(
(p) => require(`./11ty/${p}/_config`)(cfg),
);
cfg.addPassthroughCopy({ static: "/" });
// custom excerpt marker
cfg.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: "<!--more-->",
});
// browser sync for hot reload during local development
cfg.setBrowserSyncConfig({
callbacks: {
ready(_: any, browserSync: any) {
const content_404 = readFileSync("docs/404.html", fileOpts);
browserSync.addMiddleware("*", (_: any, res: any) => {
// 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,
});
cfg.setQuietMode(true);
return {
dataTemplateEngine: false,
dir: {
data: "../11ty/data",
includes: "../11ty",
input: "content",
output: "docs",
},
markdownTemplateEngine: "11ty.js",
pathPrefix: "/",
templateFormats: ["11ty.js", "md"],
};
};