My homebrew software is able to export my recipes and batches/variations of recipes as html files.
I use this data to practice filesystem operations in various programming languages and then generate an html listing page, which you can see here:
Super handy to have that at my fingertips if I'm shopping for ingredients or someone asks about a beer. If you're brewing with Chicago water - many of these recipes, like Lil Splozhun IPA, have water treatment notes (and dang that's a good IPA 😋).
This version is written in Node.js - and basically does the following:
- Looks for directory
_html
in the root of the project. - If it finds it, sanitizes each filename so it is url friendly (since we just link right to it).
- It then saves the renamed file into the
public/_html
directory, and when done, removes the original directory so it is not processed everytime the "make" script is run. (We only want to parse all those files when a fresh export is present.) - While parsing the files, the program also determines if a file is a batch or recipe, and scrapes data from each html page like the title, date, etc. While doing this it creats a big "recipe" object with all the data, and lastly sorts each recipe's batches by date.
- It takes that data, and makes a
public/recipes.json
file, which is used as the data source if you want to start the express server to work on the pug template (or use it for whatever else). - Lastly, use pug to generate a static
public/index.html
file.
🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻 🍻