This guide covers:

  • popular tools and libraries for web development

This work is licensed under a Creative Commons Attribution 3.0 Unported License (including images & stylesheets). The source is available on Github.

What Version of Clojure Does This Guide Cover?

This guide covers Clojure 1.4.

Some Options

Below are some of the various options available for web development with Clojure, listed roughly by size.

Ring and Compojure

Perhaps the simplest and most minimal setup is to use only Ring and Compojure. To get started, see the basic web development tutorial.

lib-noir

In addition to Ring and Compojure, you might also make use of lib-noir.

Luminus

Luminus is a lein template for creating batteries-included web applications. It makes use of Ring, Compojure, lib-noir, and optionally (as described in its documentation) other libraries.

Templating Libraries

Clojure has many options for building HTML.

Hiccup

Hiccup represents HTML as Clojure data structures, allowing you to create and manipulate your HTML easily.

Tinsel is a library that extends Hiccup with selectors and transformers, so that you can write a template separate from the insertion of your data into the template.

Mustache

Clostache implements the Mustache templating language for Clojure.

Stencil is another implementation of Mustache.

Fleet

Fleet embeds Clojure inside HTML templates, much like Java's JSPs, or Ruby's ERb.

Clabango

Clabango is modeled after the Django templating system. It embeds special tags and filters inside HTML templates to insert and manipulate data.

Selmer

Selmer is also modeled after the Django templating system with a primary goal of performance.

Enlive and Laser

Enlive and Laser are similar libraries. They both manipulate plain HTML, and can be used for screen scraping as well as templating. They work with HTML templates with no special embedded tags or code. They use selector functions to find pieces of HTML and transformation function to change the HTML into the way you want.

See the Laser guide to see if this style of templating works for you. It is powerful, but different from most other languages' templating libraries.

See Also

Contributors

  • John Gabriele
  • Clinton Dreisbach