-
Notifications
You must be signed in to change notification settings - Fork 1
/
eleventy.config.js
47 lines (39 loc) · 1.53 KB
/
eleventy.config.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
const htmlmin = require("html-minifier-terser");
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/bundle.css");
// https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs
eleventyConfig.addPassthroughCopy('src/favicon.ico');
eleventyConfig.addPassthroughCopy('src/icon.svg');
eleventyConfig.addPassthroughCopy('src/apple-touch-icon.png');
eleventyConfig.addPassthroughCopy('src/icon-192.png');
eleventyConfig.addPassthroughCopy('src/icon-512.png');
eleventyConfig.addPassthroughCopy('src/manifest.webmanifest');
eleventyConfig.addPassthroughCopy('src/meta.png');
eleventyConfig.addPassthroughCopy('src/robots.txt');
eleventyConfig.addPassthroughCopy('src/humans.txt');
eleventyConfig.addPassthroughCopy('src/img');
// https://huphtur.nl/eleventy-filter-to-turn-url-into-domain-name/
eleventyConfig.addFilter("domainify", function (string) {
return new URL(string).hostname.replace('www.', '');
});
eleventyConfig.addFilter('values', Object.values);
eleventyConfig.addTransform("htmlmin", function(content) {
// Prior to Eleventy 2.0: use this.outputPath instead
if( this.page.outputPath && this.page.outputPath.endsWith(".html") ) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true
});
return minified;
}
return content;
});
return {
dir: {
input: 'src',
},
};
};