Skip to content

Commit d24668c

Browse files
authored
Merge pull request #7 from cucapra/separate-files
Clean up CSS and JavaScript structure
2 parents 8e8a74b + 8f9eca2 commit d24668c

File tree

16 files changed

+1062
-319
lines changed

16 files changed

+1062
-319
lines changed

.eleventy.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
- uses: actions/checkout@v4
1010
with:
1111
submodules: true
12-
- uses: actions/setup-node@v5
12+
- uses: actions/setup-node@v6
13+
with:
14+
node-version: 25.x
1315
- name: Build
1416
run: npm install && npm run build
1517
- name: Upload artifact

eleventy.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import * as esbuild from "esbuild";
2+
3+
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+
});
22+
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+
});
29+
30+
return {
31+
dir: {
32+
input: "src",
33+
output: "_site",
34+
includes: "_includes",
35+
data: "_data",
36+
},
37+
htmlTemplateEngine: "njk",
38+
markdownTemplateEngine: "njk",
39+
};
40+
}

0 commit comments

Comments
 (0)