-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
.eleventy.js
58 lines (48 loc) · 1.47 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
const sortBy = require('lodash/sortBy');
const md = require('markdown-it')('commonmark');
const mila = require('markdown-it-link-attributes');
const mic = require('markdown-it-container');
require('dotenv').config();
md.use(mila, [
{
pattern: /^https?:\/\//,
attrs: {
target: '_blank',
rel: 'noopener noreferrer',
},
},
]);
// Correspond to class names in markdown-containers.less
md.use(mic, 'break-inside-avoid');
md.use(mic, 'columns');
md.enable('table');
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy('src/assets');
eleventyConfig.addPassthroughCopy('src/admin');
eleventyConfig.addPassthroughCopy('src/compensation-frame');
eleventyConfig.addPassthroughCopy('src/_redirects');
eleventyConfig.addWatchTarget('src/styles');
['home', 'study'].forEach((collectionName) => {
eleventyConfig.addCollection(collectionName, function (collectionApi) {
// get unsorted items
const raw = collectionApi.getFilteredByTag(collectionName);
return sortBy(raw, 'data.position');
});
});
eleventyConfig.setLibrary('md', md);
eleventyConfig.addPassthroughCopy({ 'src/favicon_io': '/' });
eleventyConfig.setBrowserSyncConfig({
https: true,
});
eleventyConfig.setEjsOptions({
async: true,
});
return {
markdownTemplateEngine: 'ejs',
htmlTemplateEngine: false, // stops compensation/index.html being mutated
dir: {
input: 'src',
layouts: '_layouts',
},
};
};