Skip to content

πŸŽ… Display your Advent of Code calendar with this static site generator πŸŽ„

License

Notifications You must be signed in to change notification settings

koalanis/advent-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ… advent-pages πŸŽ„

a simple advent-of-code project site generator

image

How it works

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. image

Get started

Installing

Install the package and run the generate command to create the site folder.

npm install --save @koalanis/advent-pages
npx @koalanis/advent-pages generate

Configuration

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.

Github workflow

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.

Example

Python Advent of Code 2015 link

details

  • built using tsup
  • default styling using NES.css
  • templating using native ts/js string templating

roadmap

  • publish npm package
  • add custom theming support

lastly

the static site is styled in NES.csshttps://github.com/nostalgic-css/NES.css πŸ™ thanks to the nostalgic-css team

About

πŸŽ… Display your Advent of Code calendar with this static site generator πŸŽ„

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages