-
Notifications
You must be signed in to change notification settings - Fork 0
/
eleventy.config.js
78 lines (68 loc) · 2.59 KB
/
eleventy.config.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
71
72
73
74
75
76
77
78
'use strict';
const {EleventyRenderPlugin} = require('@11ty/eleventy');
const {
absoluteUrl,
convertHtmlToAbsoluteUrls,
dateToRfc3339,
getNewestCollectionItemDate,
} = require('@11ty/eleventy-plugin-rss');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const yaml = require('js-yaml');
const componentsPlugin =
require('./source/helpers/components/index.ts').default;
const datesPlugin = require('./source/helpers/dates.ts').default;
const {liquidEngine, markdownEngine} = require('./source/helpers/engines.ts');
const pagesPlugin = require('./source/helpers/pages.ts').default;
const typePlugin = require('./source/helpers/type.ts').default;
const functionPlugin = require('./source/helpers/function.ts').default;
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
module.exports = eleventyConfig => {
eleventyConfig.addPassthroughCopy('source/assets/dist');
eleventyConfig.addPassthroughCopy('source/assets/img');
eleventyConfig.addPassthroughCopy('source/favicon.ico');
eleventyConfig.addPassthroughCopy('source/icon.png');
eleventyConfig.addPassthroughCopy('source/browserconfig.xml');
eleventyConfig.addPassthroughCopy('source/tile.png');
eleventyConfig.addPassthroughCopy('source/tile-wide.png');
eleventyConfig.addPassthroughCopy('source/robots.txt');
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.watchIgnores.add('source/_data/versionCache.json');
eleventyConfig.setLibrary('liquid', liquidEngine);
eleventyConfig.setLibrary('md', markdownEngine);
eleventyConfig.addDataExtension('yml, yaml', contents => yaml.load(contents));
eleventyConfig.addDataExtension('ts', {
parser: filepath => require(filepath),
read: false,
});
// register filters and shortcodes
eleventyConfig.addPlugin(componentsPlugin);
eleventyConfig.addPlugin(datesPlugin);
eleventyConfig.addPlugin(pagesPlugin);
eleventyConfig.addPlugin(typePlugin);
eleventyConfig.addPlugin(functionPlugin);
// rss plugin
eleventyConfig.addLiquidFilter('absoluteUrl', absoluteUrl);
eleventyConfig.addLiquidFilter(
'getNewestCollectionItemDate',
getNewestCollectionItemDate
);
eleventyConfig.addLiquidFilter('dateToRfc3339', dateToRfc3339);
eleventyConfig.addLiquidFilter(
'htmlToAbsoluteUrls',
convertHtmlToAbsoluteUrls
);
// other plugins
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(syntaxHighlight, {
errorOnInvalidLanguage: true,
});
eleventyConfig.setQuietMode(true);
// settings
return {
dir: {
input: 'source',
includes: '_includes',
layouts: '_layouts',
},
};
};