-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
.eleventy.js
65 lines (58 loc) · 2.91 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
59
60
61
62
63
64
65
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
// const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
// eleventyConfig.addPlugin(UpgradeHelper);
eleventyConfig.addPassthroughCopy({ "favicon.ico": "favicon.ico" });
eleventyConfig.addPassthroughCopy({ "docs/main.css": "dist/main.css" });
eleventyConfig.addPassthroughCopy({ dist: "dist" });
eleventyConfig.addPassthroughCopy({ "src/tests/fakeserver.js": "dist/fakeserver.js" }); // prettier-ignore
eleventyConfig.addPassthroughCopy({ "src/pat/querystring/test-querystringcriteria.json": "dist/test-querystringcriteria.json" }); // prettier-ignore
eleventyConfig.addPassthroughCopy({ "node_modules/prismjs": "dist/prismjs" });
eleventyConfig.addPassthroughCopy({ "node_modules/sinon": "dist/sinon" });
eleventyConfig.addPassthroughCopy({ "node_modules/tinymce/skins": "dist/skins" });
eleventyConfig.addPassthroughCopy({ "node_modules/tinymce/icons": "dist/icons" });
eleventyConfig.addPassthroughCopy({ "node_modules/tinymce/themes": "dist/themes" });
eleventyConfig.addPassthroughCopy({ "node_modules/underscore": "dist/underscore" });
eleventyConfig.addPassthroughCopy({ "node_modules/bootstrap": "dist/bootstrap" });
eleventyConfig.addPassthroughCopy({ "node_modules/jquery": "dist/jquery" });
// Filter source file names using a glob
eleventyConfig.addCollection("patterns", function (collectionApi) {
return collectionApi.getFilteredByGlob("src/pat/**/README.md");
});
eleventyConfig.addCollection("externalpatterns", function (collectionApi) {
return collectionApi.getFilteredByGlob([
"docs/external/@patternslib/patternslib/src/pat/**/*.md",
"docs/external/@patternslib/pat-*/README.md",
"docs/external/pat-*/README.md",
]);
});
eleventyConfig.addFilter("replaceString", function (arg1, arg2, arg3) {
return arg1.replace(arg2, arg3);
});
eleventyConfig.addFilter("pageTitle", (item) => {
if (item.data.title && item.data.title !== "") {
return `${item.data.title}`;
}
let url_parts = item.data.page.filePathStem.split("/");
return url_parts[url_parts.length - 2];
});
eleventyConfig.addFilter("stringify", function (value) {
return JSON.stringify(value);
});
eleventyConfig.addFilter("slugFromUrl", (item) => {
let url_parts = item.url.split("/");
return url_parts[url_parts.length];
});
eleventyConfig["dir"] = {
input: ".",
ouput: "_site",
includes: "_includes",
layouts: "_includes",
data: "_data",
};
return eleventyConfig;
};