-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
64 lines (53 loc) · 2.13 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
const collections = require('./config/collections');
const plugins = require('./config/plugins');
const passthroughs = require('./config/passthroughs');
const filters = require('./config/filters');
const filtersAsync = require('./config/filtersAsync');
const shortcodes = require('./config/shortcodes');
const watchtargets = require('./config/watch-targets');
const transforms = require('./config/transforms');
module.exports = function (eleventyConfig) {
// Create collections from /config/collections.js
Object.keys(collections).forEach((collectionName) => {
eleventyConfig.addCollection(collectionName, collections[collectionName]);
});
// Add Eleventy plugins from /config/plugins.js
Object.keys(plugins).forEach((pluginName) => {
plugins[pluginName](eleventyConfig);
});
// Add shortcodes from /config/shortcodes.js
Object.keys(shortcodes).forEach((shortcodeName, index) => {
shortcodes[shortcodeName](eleventyConfig);
});
// Create filters from /config/filters.js
Object.keys(filters).forEach((filterName) => {
eleventyConfig.addFilter(filterName, filters[filterName]);
});
// Create async filters from /config/filtersAsync.js
Object.keys(filtersAsync).forEach((filterName) => {
eleventyConfig.addNunjucksAsyncFilter(filterName, filtersAsync[filterName]);
});
// Create transforms from /config/transforms.js
Object.keys(transforms).forEach((transformName) => {
eleventyConfig.addTransform(transformName, transforms[transformName]);
});
// Get passthroughs from /config/passthroughs.js
Object.keys(passthroughs).forEach((passthroughName) => {
eleventyConfig.addPassthroughCopy(passthroughs[passthroughName]());
});
// Watch these files for changes from /config/watchTargets.js
Object.keys(watchtargets).forEach((watchtargetName) => {
eleventyConfig.addWatchTarget(watchtargets[watchtargetName]());
});
return {
templateFormats: ['md', 'njk', 'html', 'liquid'],
markdownTemplateEngine: 'liquid',
htmlTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
dir: {
input: 'src',
includes: 'assets/views',
layouts: 'assets/views/layouts',
},
};
};