Fornax is a static site generator written in F#. I think it's pretty neat. Fornax generates static sites through a pipeline of F# scripts called loaders that inject content into a global context that is then consumed by more F# scripts called generators that mold the content its final form. The workflow is decidedly hands-on with a distinct code first approach. This gives Fornax incredible flexibility.
Fornax is installed as a global .Net Core tool on the command line with:
dotnet tool install fornax -g
This will install Fornax. We can then create a new folder for our new Fornax site, then:
This will create a new Fornax site using the default blog template.
Now that we have a default Fornax site set up we can run
fornax watch which will spin up a little server that watches for changes to our project.
Let's take a look at the folder structure now that we have a working Fornax site.
- Any external libraries we might like to use go in here and can be referenced from the script files.
- By default this contains:
- This is where the final production built files are created after a build.
- Contains all scripts that load data into the global context.
- Contains all scripts that generate files in _public based on the global context created by loaders.
- Images used by our app
- JS used by our app
- This is a domain specific folder used to hold blog posts written in markdown.
- CSS used by the app
- This script runs first, we use it to configure the behavior of our generators and add any additional data like secret keys or SQL connection strings.
Next time we'll take a look an in depth look at loaders and generators and what they can do.