-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheleventy.config.js
83 lines (74 loc) · 2.63 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
79
80
81
82
83
import path from 'node:path';
import { EleventyRenderPlugin as pluginRender } from '@11ty/eleventy';
import { eleventyImageTransformPlugin as pluginImage } from '@11ty/eleventy-img';
import pluginWebc from '@11ty/eleventy-plugin-webc';
import pluginRss from '@11ty/eleventy-plugin-rss';
import {
humanReadableDate,
getTOC,
youtubeIdFromUrl,
findPostByPath,
sortedByDate,
sortedByPublishDate,
toSet,
readTime,
monthYearDate,
humanReadableDateTime,
toISOString,
} from './_11ty/filters.js';
import { markdownLibrary } from './_11ty/libraries.js';
import { collectionHostedCaseStudy } from './_11ty/collections.js';
/**
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
*/
export default async function (eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginRender);
eleventyConfig.addPlugin(pluginImage, {
extensions: 'html',
formats: ['webp', 'jpeg'],
widths: ['auto', 400, 800, 1400],
defaultAttributes: {
loading: 'lazy',
decoding: 'async',
sizes: '100vw',
},
filenameFormat: function (id, src, width, format, options) {
const extension = path.extname(src);
const name = path.basename(src, extension);
return `${name}-${width}w.${format}`;
},
sharpOptions: {
animated: true,
limitInputPixels: false,
},
});
eleventyConfig.addPlugin(pluginWebc, {
components: ['./src/_components/**/*.webc'],
});
eleventyConfig.addWatchTarget('./src/scss/**/*');
eleventyConfig.addWatchTarget('./src/js/**/*');
eleventyConfig.addPassthroughCopy('./src/js/vendor', 'js');
eleventyConfig.addPassthroughCopy('./src/meta');
eleventyConfig.addPassthroughCopy('./src/fonts');
eleventyConfig.addPassthroughCopy('./src/img');
eleventyConfig.addPassthroughCopy('./src/functions');
eleventyConfig.addCollection('hosted case study', collectionHostedCaseStudy);
eleventyConfig.addFilter('getTOC', getTOC);
eleventyConfig.addFilter('youtubeIdFromUrl', youtubeIdFromUrl);
eleventyConfig.addFilter('findPostByPath', findPostByPath);
eleventyConfig.addFilter('sortedByDate', sortedByDate);
eleventyConfig.addFilter('sortedByPublishDate', sortedByPublishDate);
eleventyConfig.addFilter('toSet', toSet);
eleventyConfig.addFilter('readTime', readTime);
eleventyConfig.addFilter('monthYearDate', monthYearDate);
eleventyConfig.addFilter('humanReadableDateTime', humanReadableDateTime);
eleventyConfig.addFilter('humanReadableDate', humanReadableDate);
eleventyConfig.addFilter('toISOString', toISOString);
eleventyConfig.setLibrary('md', markdownLibrary);
return {
dir: {
input: 'src',
},
};
}