aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/config.ts
blob: 75ba2dd13fadbc939afb27e39fdd0940f4d3b569 (plain) (blame)
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
import { getTimestamp } from "./util/timestamp";
import BuildInfo from "../config.json";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function (eleventyConfig: any) {
  // passthrough static files to public
  eleventyConfig.addPassthroughCopy({
    "./src/static/": "/",
  });

  // hook in configured build time for GH action to update
  eleventyConfig.addGlobalData("buildTimeEncoded", () => {
    return getTimestamp(Number(BuildInfo.version));
  });

  // ensure eleventy marks this config as watched, since it's typescript
  eleventyConfig.addWatchTarget("./src/config.ts");

  return {
    templateFormats: ["njk", "html"],
    htmlTemplateEngine: "njk",
    dir: {
      input: "src/pages",
      includes: "../templates",
      output: "public",
    },
  };
}