-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
61 lines (51 loc) · 2.22 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
// filters
const console = require('./src/_11ty/filters/console.js');
const { dateReadable, dateGetYear } = require('./src/_11ty/filters/date.js');
// plugins
const toc = require('eleventy-plugin-nesting-toc'); // https://github.com/JordanShurmer/eleventy-plugin-nesting-toc
const syntaxHighlighting = require('@11ty/eleventy-plugin-syntaxhighlight');
const rss = require('@11ty/eleventy-plugin-rss');
const assetsForPermalink = require('eleventy-plugin-page-assets');
const svgContents = require("eleventy-plugin-svg-contents"); // https://github.com/brob/eleventy-plugin-svg-contents
const { markdownConfigured } = require('./src/_11ty/plugins/markdown-it.js');
// collections
const orderedTimelineEvents = require('./src/_11ty/collections/orderedTimelineEvents.js');
const orderedCaseStudies = require('./src/_11ty/collections/orderedCaseStudies.js');
const blogPosts = require('./src/_11ty/collections/blogPosts.js');
module.exports = function (eleventyConfig) {
const markdownIt = require('markdown-it');
// configure markdown
eleventyConfig.setLibrary('md', markdownConfigured(markdownIt));
// filters
eleventyConfig.addFilter('console', console);
eleventyConfig.addFilter('dateReadable', dateReadable);
eleventyConfig.addFilter('dateGetYear', dateGetYear);
eleventyConfig.addFilter('markdown', value => markdownConfigured(markdownIt).render(value));
// plugins
eleventyConfig.addPlugin(svgContents);
eleventyConfig.addPlugin(toc, {tags: ['h2', 'h3', 'h4', 'h5', 'h6']});
eleventyConfig.addPlugin(syntaxHighlighting);
eleventyConfig.addPlugin(rss);
eleventyConfig.addPlugin(assetsForPermalink, {
mode: 'directory',
hashAssets: false,
postsMatching: 'src/content/posts/*/*.md'
});
// Collections
eleventyConfig.addCollection('orderedTimelineEvents', orderedTimelineEvents);
eleventyConfig.addCollection('orderedCaseStudies', orderedCaseStudies);
eleventyConfig.addCollection('blogPosts', blogPosts);
// copy these static assets
eleventyConfig.addPassthroughCopy('src/assets');
eleventyConfig.addPassthroughCopy('src/sw.js');
eleventyConfig.setServerOptions({
watch: ['dist/css/**/*.css']
});
return {
dir: {
input: "src",
output: "dist",
layouts: "_layouts"
},
};
};