-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
55 lines (50 loc) · 1.47 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const htmlmin = require("html-minifier");
const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
// const faviconsPlugin = require("eleventy-plugin-gen-favicons");
const yaml = require("js-yaml");
const embedEverything = require("eleventy-plugin-embed-everything");
module.exports = function (eleventyConfig) {
/**
* Upgrade helper
* Uncomment if you need help upgrading to new major version.
*/
//eleventyConfig.addPlugin(UpgradeHelper);
/**
* Files to copy
* https://www.11ty.dev/docs/copy/
*/
// eleventyConfig.addPlugin(faviconsPlugin, {
// outputDir: "./_site",
// });
eleventyConfig.addDataExtension("yaml", (contents) => yaml.load(contents));
eleventyConfig.addPlugin(embedEverything);
eleventyConfig.addPassthroughCopy("src/img");
eleventyConfig.addPassthroughCopy({
"./src/admin/config.yml": "./admin/config.yml",
"./src/drag.js": "./js_lp/drag.js", //this is the JS file for the salad interactive
});
/**
* HTML Minifier for production builds
*/
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
if (
process.env.ELEVENTY_ENV == "production" &&
outputPath &&
outputPath.endsWith(".html")
) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
});
return minified;
}
return content;
});
return {
dir: {
input: "src",
data: "../_data",
},
};
};