-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
58 lines (42 loc) · 1.89 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
53
54
55
56
57
58
require("json5/lib/register");
const { EleventyRenderPlugin } = require("@11ty/eleventy");
const externalLinks = require("@aloskutov/eleventy-plugin-external-links");
const registerExtensions = require("./11ty-extensions");
const fs = require('fs');
const path = require('path');
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({ "./src/assets/": "assets" });
eleventyConfig.addPassthroughCopy({ "./node_modules/font-awesome/css": "assets/font-awesome/css" });
eleventyConfig.addPassthroughCopy({ "./node_modules/font-awesome/fonts": "assets/font-awesome/fonts" });
eleventyConfig.addPassthroughCopy({ "./node_modules/highlight.js/styles/atom-one-dark.min.css": "styles/atom-theme.min.css" });
eleventyConfig.addPassthroughCopy({ "./client-side-compiled/**/*": "scripts" });
eleventyConfig.addPassthroughCopy({ "./styles-compiled/**/*": "styles" });
eleventyConfig.addPassthroughCopy({ "./src/copy-to-root/*": "." });
eleventyConfig.addPassthroughCopy({ "./node_modules/lunr/lunr.min.js": "scripts/libs/lunr.min.js" });
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.setDataDeepMerge(false);
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(externalLinks, { overwrite: false });
eleventyConfig.setServerOptions({
showAllHosts: true
});
eleventyConfig.setWatchThrottleWaitTime(100);
registerExtensions(eleventyConfig);
eleventyConfig.addShortcode("include_raw", function(file) {
const inputPath = this.page.inputPath;
const inputDir = path.dirname(inputPath);
const filePath = path.join(inputDir, file);
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath, 'utf8');
} else {
console.warn(`Warning: File not found - ${filePath}`);
return `<!-- File not found: ${file} -->`;
}
});
return {
pathPrefix: "/",
dir: {
input: "src/pages",
}
}
};