-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
42 lines (38 loc) · 1.27 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
const htmlmin = require('html-minifier');
module.exports = function (config) {
config.addPassthroughCopy({
'src/favicon/favicon.ico': 'favicon.ico',
'src/favicon/favicon.svg': 'favicon.svg',
});
config.addPassthroughCopy('src/manifest.webmanifest');
config.addPassthroughCopy('src/style.css');
config.addPassthroughCopy('src/script.js');
config.addPassthroughCopy('src/fugu-patterns.js');
config.addPassthroughCopy(
'src/**/*.(html|jpg|png|webp|avif|ico|svg|mp4|xml)',
);
config.addTransform('htmlmin', function (content, outputPath) {
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
if (outputPath && outputPath.endsWith('.html')) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
});
return minified;
}
return content;
});
return {
dir: {
input: 'src',
output: 'docs',
data: 'data',
},
dataTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
passthroughFileCopy: true,
templateFormats: ['md', 'njk'],
};
};