This project builds a node script (dist/index.js) that scans a directory for a advent.config.json
file and uses metadata in that file to generate a static site to the folder advent-pages
.
The metadata provided allows you to specify which code file corresponds to a advent problem and solution and renders it in a standalone page. Configuration uses relative pathing to where the script process is running.
Install the package and run the generate
command to create the site folder.
npm install --save @koalanis/advent-pages
npx @koalanis/advent-pages generate
The static site's metadata is configured in a advent.config.json
file.
{
"lang": "rust",
"year": 2021,
"days": {
"1": {
"partOneDone": true,
"testDataOne": "./test_data.txt",
"codeOne": "./src/day1/partone.rs",
"answerOne": "./answer.txt",
"partTwoDone": true,
"testDataTwo": "./test_data_2.txt",
"codeTwo": "./src/day1/parttwo.rs",
"answerTwo": "./answer_2.txt",
},
...
"25": {...}
}
}
The fields days[n].partOneDone
and days[n].partTwoDone
are booleans that signify if a problem has been compelted, which in turn effects how the completion stars are rendered on the static site.
The other fields in days[n]
, such as testDataOne
, codeOne
, etc, are relative paths that are used to inject source text blobs into the static site for display. You can use this to display your advent data & answers, and most importantly, your code solutions.
You can configure this static site generator to work in combination of a github pages. You can add an action to publish the static onto your advent of code github repos. For a template of doing this, take a look at my starter.
Python Advent of Code 2015 link
- publish npm package
- add custom theming support
the static site is styled in NES.csshttps://github.com/nostalgic-css/NES.css π thanks to the nostalgic-css team