-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eleventy.js
39 lines (34 loc) · 891 Bytes
/
.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
const { minify } = require('html-minifier-terser');
const jsonminify = require('jsonminify');
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({
'site/static': './',
'dist/css': './assets/css/',
});
eleventyConfig.addNunjucksShortcode(
'postcss',
require('./utils/postcss'),
true,
);
eleventyConfig.addPairedNunjucksShortcode('jsonMinify', (data) => {
return jsonminify(data);
});
eleventyConfig.addTransform('htmlmin', async (content, outputPath) => {
if (outputPath.endsWith('.html')) {
return await minify(content, {
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
});
}
return content;
});
return {
dir: {
input: 'site/src',
},
templateFormats: ['md', 'njk'],
markdownTemplateEngine: 'njk',
};
};