-
Notifications
You must be signed in to change notification settings - Fork 24
/
.eleventy.js
43 lines (38 loc) · 939 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
40
41
42
43
const htmlmin = require('html-minifier')
const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
module.exports = function(eleventyConfig) {
/**
* Upgrade helper
* Uncomment if you need help upgrading to new major version.
*/
//eleventyConfig.addPlugin(UpgradeHelper);
/**
* Files to copy
* https://www.11ty.dev/docs/copy/
*/
eleventyConfig.addPassthroughCopy('src/img')
/**
* HTML Minifier for production builds
*/
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
if (
process.env.ELEVENTY_ENV == 'production' &&
outputPath &&
outputPath.endsWith('.html')
) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
})
return minified
}
return content
})
return {
dir: {
input: "src",
data: "../_data"
}
};
};