-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
70 lines (59 loc) · 2.48 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
66
67
68
69
70
const pluginRss = require("@11ty/eleventy-plugin-rss");
const svgSprite = require("eleventy-plugin-svg-sprite");
const shortcodes = require("./src/_utils/11ty.shortcodes.js");
const filters = require("./src/_utils/11ty.filters.js");
const collections = require("./src/_utils/11ty.collections.js");
module.exports = async function(eleventyConfig) {
const { EleventyRenderPlugin } = await import("@11ty/eleventy");
eleventyConfig.setQuietMode(true);
// Plugins
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(svgSprite, {
path: "./src/_assets/svg",
outputFilepath: "./dist/_assets/svgSprite.svg"
});
// Shortcodes
eleventyConfig.addNunjucksAsyncShortcode("rwdImg", shortcodes.rwdImg);
eleventyConfig.addNunjucksAsyncShortcode("socialImg", shortcodes.socialImg);
eleventyConfig.addNunjucksShortcode("mapUrl", shortcodes.mapUrl);
eleventyConfig.addNunjucksShortcode("svgIcon", shortcodes.svgIcon);
eleventyConfig.addNunjucksShortcode("dateRange", shortcodes.dateRange);
// Filters
Object.keys(filters).forEach((filterName) => {
eleventyConfig.addFilter(filterName, filters[filterName]);
});
// Collections
Object.keys(collections).forEach((collectionName) => {
eleventyConfig.addCollection(collectionName, collections[collectionName]);
});
const layouts = [
{name: 'default', path: 'layouts/base.njk'},
{name: 'textPage', path: 'layouts/textPage.njk'},
];
layouts.forEach(layout => eleventyConfig.addLayoutAlias(layout.name, layout.path));
// Copy the files to the right place
[
"src/humans.txt",
"src/robots.txt",
].forEach(path => eleventyConfig.addPassthroughCopy(path));
eleventyConfig.addPassthroughCopy({"src/_assets/favicon/**": "."});
eleventyConfig.addPassthroughCopy({"src/_assets/img/passThrough/podcast-cover.jpg": "assets/podcast-cover.jpg"});
eleventyConfig.addPassthroughCopy({"src/_assets/img/passThrough/the-globe-church-og.jpg": "_assets/img/the-globe-church-og.jpg"});
eleventyConfig.addPassthroughCopy({"src/_assets/img/passThrough/**": "assets/img/passThrough"});
eleventyConfig.addGlobalData("buildDate", new Date());
return {
templateFormats: ["html", "njk", "md", "11ty.js"],
pathPrefix: "/",
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
passthroughFileCopy: true,
dir: {
input: `./src`,
output: `./dist`,
includes: "_includes",
data: "_data",
},
};
}