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. We’ll use the default Leiningen template for this purpose.

 $ ​​lein​​ ​​new​​ ​​html-templating

Once the project is created, ...

Get Web Development with Clojure, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.