-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
34 lines (27 loc) · 1012 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
const htmlmin = require("html-minifier");
const now = String(Date.now());
module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./styles/tailwind.config.js");
eleventyConfig.addWatchTarget("./styles/tailwind.css");
eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("fonts");
eleventyConfig.addPassthroughCopy("scripts");
eleventyConfig.addPassthroughCopy("./favicon.ico", "./favicon.ico");
eleventyConfig.addPassthroughCopy({
"./node_modules/alpinejs/dist/cdn.js": "./js/alpine.js",
});
eleventyConfig.addShortcode("version", function () {
return 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;
});
};