Skip to content

Commit 433d27e

Browse files
committed
Implement 11ty
1 parent 74b29d5 commit 433d27e

File tree

14 files changed

+2287
-35
lines changed

14 files changed

+2287
-35
lines changed

.eleventy.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { env } from 'process';
2+
3+
import { minify } from 'html-minifier-terser';
4+
5+
export default function (eleventyConfig) {
6+
// Copy static assets
7+
eleventyConfig.addPassthroughCopy('public');
8+
9+
// In dev mode, don't minify
10+
if (env.NODE_ENV === 'production') {
11+
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
12+
if (outputPath?.endsWith('.html')) {
13+
const minified = minify(content, {
14+
useShortDoctype: true,
15+
removeComments: true,
16+
collapseWhitespace: true,
17+
minifyCSS: true,
18+
minifyJS: {
19+
safari10: false,
20+
ecma: undefined,
21+
output: { comments: false },
22+
},
23+
});
24+
return minified;
25+
}
26+
return content;
27+
});
28+
}
29+
30+
return {
31+
dir: {
32+
input: 'src-11ty',
33+
output: 'dist',
34+
},
35+
};
36+
}

0 commit comments

Comments
 (0)