HTML Templating Using Selmer

Selmer is a general-purpose templating engine that’s content-agnostic. While it’s primarily geared toward working with HTML, it can be used to transform any kind of text. If you’re already familiar with Django or similar templating languages, you should feel right at home using Selmer.

When applied to generating HTML templates, Selmer encourages a clean separation between the presentation and the business logic. On top of that, the templates can be maintained by someone who has no knowledge of Clojure. Let’s create a new project where we’ll learn to use different features of Selmer. Let’s use the default Leiningen template for this purpose.

 lein new html-templating

Once the project is created, add the Selmer ...

Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.