cryogen-project / cryogen-project/cryogen-core

Refactor compiler to separate impure and pure code

Open
#105 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Clojure
Stars
72
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Currently the compiler has quite a bit of io spread out in many functions. It would be nice to refactor it into three distinct phases.

* reading posts, pages and the config into a data-structure
* transforming that data structure into a new one
* writing the transformed data structure to disk

All the difficult things are moved into the pure middle part, which becomes a lot more convenient to test and nicer to work with in general. (It's probably not necessary to be militant about purity, the printlns that are scattered around are kind of nice.)

The output data structure could be a map from url to finished html. There's a [quite nice library](https://github.com/magnars/stasis) that takes a data structure like that and either writes it to disk or serves it locally with ring. Using that we could save quite a bit of code in the compiler and, more importantly, code in the template.

It also has some other niceties.

* Reporting on conflicting urls.
* Reporting on differences in the built files.

Any thoughts on this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.