-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheleventy.config.js
More file actions
executable file
·34 lines (32 loc) · 1.18 KB
/
eleventy.config.js
File metadata and controls
executable file
·34 lines (32 loc) · 1.18 KB
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
import fs from "fs";
import dateFilter from "./scripts/dateFilter.js";
import dotenv from "dotenv";
dotenv.config();
export default async function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("./src/fonts/**/*.*");
eleventyConfig.addPassthroughCopy("./src/images/**/*.{png,jpg,webp}");
eleventyConfig.addPassthroughCopy("./src/favicon.ico");
eleventyConfig.addPassthroughCopy("./src/media/**/*.{mp3,mp4,webm,jpg,png}");
eleventyConfig.addPassthroughCopy("./src/workers/**/*.js");
eleventyConfig.addWatchTarget("./src/js/");
eleventyConfig.addWatchTarget("./src/scss/");
eleventyConfig.addFilter("date", dateFilter);
eleventyConfig.addShortcode("year", () => {
return String(new Date().getFullYear());
});
eleventyConfig.addShortcode("nonce", () => {
const nonce = Array.from(crypto.getRandomValues(new Uint8Array(16)))
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
return nonce;
});
eleventyConfig.addFilter("fsRead", (path) => fs.readFileSync(path, "utf8"));
return {
dir: {
input: "src",
includes: "_includes",
layouts: "_layouts",
},
templateFormats: ["html", "hbs", "njk", "md", "11ty.js"],
};
}