Fabricate

“Form by art and labor”
Simple, flexible website generation with Clojure
GitHub

Introducing Fabricate, a Clojure library for making static websites, using Clojure.

Fabricate gives you something other tools don't: the power to evaluate Clojure code to generate the contents of a page. The “using Clojure” part of that first sentence contains the core idea: Fabricate is built on the idea that you should be able to use Clojure to generate as much (or little) of your website as is necessary.

What does that look like?

Examples


(let [s "output"]
(list [:hr]
[:strong (format "a form evaluated and displayed with its %s" s)])
)

a form evaluated and displayed with its output

Fabricate gives you a template that allows you to mix regular text and Clojure expressions. Hiccup forms returned by those expressions become HTML elements when Fabricate generates the page.

Fabricate also gives you an API that can generate a website using 3 core functions.

A simple API

(-> {}
api/plan!
api/assemble
api/construct!)

This API, while straightforward enough to quickly get started with, does not constrain what you can do with Fabricate. You can extend Fabricate to new markup formats or other methods of generating pages. If you use Clerk for some things and markdown for others, Fabricate can flexibly accommodate all of them with a unified API.

Simple things should be simple. Complex things should be possible.
Alan Kay
(require '[my-generation-code :refer [generate]])

(defmethod api/build [:my/format :hiccup]
[entry options]
(generate entry))


Documentation


Tutorials

These guides will get you up and running with Fabricate, so you can use it as a writing and creative tool. Hopefully you find them useful.

Tutorial 1: Using Fabricate to add documentation to an existing Clojure project

This first tutorial allows you to use Fabricate to document a project or library you've built.

Tutorial 2: Using Fabricate to create a website

🏗️ To be published.

In the second tutorial, you will learn how to publish all the pages you create using Fabricate as a website.

How-to guides


Supporting Fabricate in Emacs

Consult this guide to add support for Fabricate's templates to Emacs.

Further guides (to be published 🏗.)

Reference

Background Information

Namespaces


The namespace descriptions, automatically generated from the namespace forms, introduce the functionality that fabricate assembles to create pages.