|
1 | | -import * as esbuild from "esbuild"; |
2 | | - |
3 | 1 | export default function (eleventyConfig) { |
4 | | - // Static resources. |
5 | | - eleventyConfig.addPassthroughCopy("src/style.css"); |
6 | | - |
7 | | - // This is the incantation recommended to enable TypeScript compilation for |
8 | | - // frontend scripts. |
9 | | - eleventyConfig.addTemplateFormats("ts"); |
10 | | - eleventyConfig.addExtension("ts", { |
11 | | - outputFileExtension: "js", |
12 | | - compile: async (inputContent, inputPath) => { |
13 | | - return async (data) => { |
14 | | - let { code } = await esbuild.transform(inputContent, { |
15 | | - loader: "ts", |
16 | | - minify: process.env.NODE_ENV === "production", |
17 | | - }); |
18 | | - return code; |
19 | | - }; |
20 | | - }, |
21 | | - }); |
| 2 | + // Ignore .gitignore and use .eleventyignore instead |
| 3 | + eleventyConfig.setUseGitIgnore(false); |
22 | 4 |
|
23 | | - eleventyConfig.addFilter("bitRange", function (range) { |
24 | | - if (!range) return ""; |
25 | | - if (typeof range === "string") return range; |
26 | | - if (Array.isArray(range)) return `${range[0]}-${range[1]}`; |
27 | | - return String(range); |
28 | | - }); |
| 5 | + // Copy over static resources. |
| 6 | + eleventyConfig.addPassthroughCopy("src/css"); |
| 7 | + eleventyConfig.addPassthroughCopy("src/scripts/**/*.js"); |
29 | 8 |
|
30 | | - return { |
31 | | - dir: { |
32 | | - input: "src", |
33 | | - output: "_site", |
34 | | - includes: "_includes", |
35 | | - data: "_data", |
36 | | - }, |
37 | | - htmlTemplateEngine: "njk", |
38 | | - markdownTemplateEngine: "njk", |
39 | | - }; |
| 9 | + // Directory configurations and template engines. |
| 10 | + return { |
| 11 | + dir: { |
| 12 | + input: "src", |
| 13 | + output: "_site", |
| 14 | + includes: "_includes", |
| 15 | + data: "_data", |
| 16 | + }, |
| 17 | + htmlTemplateEngine: "njk", |
| 18 | + markdownTemplateEngine: "njk", |
| 19 | + }; |
40 | 20 | } |
0 commit comments