-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
38 lines (35 loc) · 1 KB
/
.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
const htmlmin = require("html-minifier");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({
"./node_modules/alpinejs/dist/alpine.js": "./js/alpine.js",
});
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget("./_tmp/style.css");
eleventyConfig.addPassthroughCopy({ "./_tmp/style.css": "./style.css" });
eleventyConfig.addPassthroughCopy( "src/js" );
eleventyConfig.addPassthroughCopy('src/images');
eleventyConfig.addPassthroughCopy('src/fonts');
eleventyConfig.addShortcode("version", function () {
return String(Date.now());
});
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
if (
process.env.ELEVENTY_PRODUCTION &&
outputPath &&
outputPath.endsWith(".html")
) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
});
return minified;
}
return content;
});
};