-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
executable file
·57 lines (46 loc) · 1.51 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
const moment = require('moment');
const pluginRss = require('@11ty/eleventy-plugin-rss');
const cacheBuster = require('@mightyplow/eleventy-plugin-cache-buster');
const MarkdownNunjucksExtension = require('nunjucks-markdown/lib/markdown_tag');
const marked = require('marked');
module.exports = eleventyConfig => {
const cacheBusterOptions = {
outputDirectory: 'dist'
};
eleventyConfig.addNunjucksTag("markdown", function(nunjucksEngine) {
return new MarkdownNunjucksExtension(nunjucksEngine, marked);
});
eleventyConfig.addPlugin(cacheBuster(cacheBusterOptions));
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addFilter('permalink', str => {
return str.replace(/\.html/g, '');
});
eleventyConfig.addFilter("date", function(value) {
return moment(value).format('D MMM YYYY');
});
eleventyConfig.addFilter("year", function(value) {
return moment(value).format('YYYY');
});
eleventyConfig.addFilter('strip_html', str => {
return str.replace(
/<script.*?<\/script>|<!--.*?-->|<style.*?<\/style>|<.*?>/g,
''
)
});
eleventyConfig
.addPassthroughCopy('src/assets/fonts/')
.addPassthroughCopy('src/site.webmanifest')
return {
templateFormats: ['njk', 'md', 'html', 'png', 'ico', 'svg', 'xml', 'jpg', 'jpeg', 'gif'],
dir: {
input: 'src',
includes: '_includes',
data: '_data',
output: 'dist'
},
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
passthroughFileCopy: true
}
}