This repository has been archived by the owner on Dec 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.cjs
75 lines (64 loc) · 2.47 KB
/
eleventy.config.cjs
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
const {minifyHtml} = require('./config/minify-html');
const {loadIcon} = require('./shortcode/alwatr-icon.js');
const {postcssProcess} = require('./config/postcss.js');
const pluginRss = require('@11ty/eleventy-plugin-rss');
const {esbuildTransform, esbuildBuild} = require('./config/esbuild.js');
const {date} = require('./config/date.js');
const {markdown} = require('./config/markdown.js');
const {imageShortcode} = require('./shortcode/image.js');
const {editOnGitHub} = require('./shortcode/edit-on-github.js');
const directoryOutputPlugin = require('@11ty/eleventy-plugin-directory-output');
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const pluginTOC = require('eleventy-plugin-toc');
/**
* 11ty configuration.
* @param {import("@11ty/eleventy").UserConfig} eleventyConfig
* @returns {ReturnType<import("@11ty/eleventy/src/defaultConfig")>}
*/
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({
assets: '/',
'assets/img/meta/favicon.ico': '/favicon.ico',
});
eleventyConfig.setQuietMode(true);
eleventyConfig.addWatchTarget('site');
eleventyConfig.setLibrary('md', markdown);
eleventyConfig.on('eleventy.before', esbuildBuild);
eleventyConfig.addShortcode('image', imageShortcode);
eleventyConfig.addShortcode('editOnGitHub', editOnGitHub);
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(pluginTOC, {
tags: ['h2', 'h3'],
wrapper: 'div',
wrapperClass: 'toc',
});
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(directoryOutputPlugin, {
columns: {
filesize: true,
benchmark: true,
},
warningFileSize: 400 * 1000,
});
eleventyConfig.addFilter('humanReadableDate', date);
eleventyConfig.addFilter('trimer', (content) => content.trim());
eleventyConfig.addAsyncFilter('postcss', postcssProcess);
eleventyConfig.addAsyncFilter('esbuild', esbuildTransform);
eleventyConfig.addShortcode('alwatrIcon', loadIcon);
eleventyConfig.addTransform('minifyHtml', minifyHtml);
eleventyConfig.addTransform('trimer', (content) => content.trim());
return {
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
templateFormats: ['njk', '11ty.js', 'md'],
dir: {
input: 'site',
output: 'dist',
includes: '_includes',
data: '_data',
layouts: '_layouts',
},
};
};