-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eleventy.js
67 lines (57 loc) · 1.81 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
const chalk = require('chalk');
const markdown = require('markdown-it')({ html: true });
const cacheBuster = require('@mightyplow/eleventy-plugin-cache-buster');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const transforms = require('./utils/transforms.js');
const filters = require('./utils/filters.js');
const shortcodes = require('./utils/shortcodes.js');
module.exports = (config) => {
console.log(chalk.black.bgGreen('Eleventy is building, please wait…'));
// Pass-through files
config.addPassthroughCopy({
'src/assets/favicon.ico': 'favicon.ico',
'src/assets/robots.txt': 'robots.txt',
'src/assets/manifest.webmanifest': 'manifest.webmanifest',
'src/assets/images': 'static/images',
'src/assets/fonts': 'static/fonts',
'src/articles/**/*.(jpg|png|svg|mp4|webm)': '',
});
// Add plugins
config.addPlugin(
cacheBuster({
outputDirectory: 'dist',
})
);
config.addPlugin(syntaxHighlight, {
alwaysWrapLineHighlights: false,
trim: true,
});
// Add shortcodes
Object.keys(shortcodes).forEach((shortcodeName) => {
config.addFilter(shortcodeName, shortcodes[shortcodeName]);
});
// Add filters
Object.keys(filters).forEach((filterName) => {
config.addFilter(filterName, filters[filterName]);
});
// Add transforms
Object.keys(transforms).forEach((transformName) => {
config.addTransform(transformName, transforms[transformName]);
});
config.setDataDeepMerge(true);
config.setUseGitIgnore(false);
return {
dir: {
input: 'src',
output: 'dist',
includes: 'components',
layouts: 'layouts',
data: 'data',
},
dataTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
passthroughFileCopy: true,
templateFormats: ['md', 'njk'],
};
};