What’s in a Template

A Leiningen template is a collection of assets that are used to generate a particular project. The templates use the Stencil library to inject dynamic content, such as the name of the project, into the asset files when they’re rendered.[103]

We’ll take a look at a template project called compojure-template to see how it works.[104]

Since templates are Leiningen projects, they each contain a project.clj file.

 (defproject compojure/lein-template ​"0.4.2"
  :description ​"Compojure project template for Leiningen"
  :url ​"https://github.com/weavejester/compojure-template"
  :eval-in-leiningen true
  :license {:name ​"Eclipse Public License"
  :url ​"http://www.eclipse.org/legal/epl-v10.html" ...

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.