forked from coulditbebort/webring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
51 lines (44 loc) · 1.45 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
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const htmlMinifier = require('html-minifier')
module.exports = function (config) {
config.addPlugin(syntaxHighlight)
config.addLayoutAlias('base', 'base.njk')
config.addLayoutAlias('page', 'page.njk')
config.addFilter('mapNodes', function (nodes, radius, width, height) {
return nodes.map((node, index) => {
const angle = (index / (nodes.length / 2)) * Math.PI
const x = radius * Math.cos(angle) + width / 2
const y = radius * Math.sin(angle) + height / 2
return {
title: node.title,
url: node.url,
x,
y
}
})
})
config.addTransform('htmlmin', function (content, outputPath) {
if (outputPath.endsWith('.html')) {
return htmlMinifier.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true
})
}
return content
})
config.addPassthroughCopy('src/assets/images')
return {
dir: {
input: 'src',
output: 'dist',
includes: 'includes',
layouts: 'layouts',
data: 'data'
},
templateFormats: ['njk', 'md', '11ty.js'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
passthroughFileCopy: true
}
}