-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
68 lines (56 loc) · 2.33 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
65
66
67
68
// Import plugins
const rssPlugin = require('@11ty/eleventy-plugin-rss');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const markdown = require('@frontendweekly/eleventy-plugin-markdown');
// Import filters
const filterDateOrdinalSuffix = require('@frontendweekly/filter-date-ordinal-suffix');
const filterDateIso = require('@frontendweekly/filter-date-iso');
// Import transforms
const transformHtmlMin = require('@frontendweekly/transform-htmlmin');
const transformEnhancePostIframe = require('@frontendweekly/transform-enhance-post-iframe');
const transformEnhancePostCodeBlock = require('@frontendweekly/transform-enhance-post-code-block');
const transformEnhancePostImg = require('@frontendweekly/transform-enhance-post-img');
// Import collection
const collectionPost = require('@frontendweekly/collection-posts');
const collectionPostFeed = require('@frontendweekly/collection-postfeed');
// Import data files
const site = require('./11ty/_data/site.json');
module.exports = function (config) {
// Watch postcss
config.addWatchTarget('./11ty/_postcss/');
// Plugins
config.addPlugin(rssPlugin);
config.addPlugin(syntaxHighlight);
config.setLibrary('md', markdown);
// Filters
config.addFilter('dateOrdinalSuffixFilter', filterDateOrdinalSuffix);
config.addFilter('dateIsoFilter', filterDateIso);
// Transforms
config.addTransform('enhancePostIframe', transformEnhancePostIframe);
config.addTransform('enhancePostCodeBlock', transformEnhancePostCodeBlock);
config.addTransform('enhancePostImg', transformEnhancePostImg);
config.addTransform('htmlmin', transformHtmlMin);
// Passthrough copy
config.addPassthroughCopy({'11ty/generated': 'images'});
config.addPassthroughCopy('11ty/favicon.*');
config.addPassthroughCopy('11ty/humans.txt');
// Layout aliases
config.addLayoutAlias('home', 'layouts/home.njk');
// Custom collections
config.addCollection('posts', (collection) =>
collectionPost(collection, './11ty/posts/*.md')
);
config.addCollection('postFeed', (collection) =>
collectionPostFeed(collection, './11ty/posts/*.md', site.maxPostsPerPage)
);
return {
dir: {
input: '11ty',
output: 'dist',
},
templateFormats: ['njk', 'md', '11ty.js'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
passthroughFileCopy: true,
};
};