Migrating HTML markup into code with Clojure and Hiccup
In the previous post, I implemented a graphic design as HTML and CSS. But the HTML will need to vary depending on what’s being displayed. We could simply duplicate the page for every variation, but this is cumbersome and leads to brittleness. Instead, we want to transition the HTML markup to a more malleable medium: code.
Specifically, we’ll be implementing the HTML as Clojure code that uses the Hiccup library to produce equivalent HTML markup. This will make future variation and extension of the markup easy. In fact, in the video, I also implement a variation of the original page.
Here’s the video on YouTube (68 minutes). Topics include:
- adding ‘middleware’ to a a Clojure web server
- using feedback loops for development
- Clojure, including basic syntax, namespaces, and the Hiccup library
- HTML markup