-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
.eleventy.js
33 lines (28 loc) · 839 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
const htmlmin = require("html-minifier");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy('src/js');
eleventyConfig.addPassthroughCopy('src/img');
eleventyConfig.addWatchTarget('src/js');
eleventyConfig.addWatchTarget('src/scss');
eleventyConfig.setTemplateFormats(['ejs']);
eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
if( outputPath.endsWith(".html") ) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyJS: true
});
return minified;
}
return content;
});
return {
dir: {
input: 'src',
output: 'dist',
// includes: 'src/_includes',
},
};
};