Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A ClojureScript implementation of Hiccup

branch: master

bulleting and use of Element protocol

Signed-off-by: Chris Granger <ibdknox@gmail.com>
latest commit ac992fa48e
Chris Granger authored December 16, 2013
Octocat-spinner-32 src bulleting and use of Element protocol December 16, 2013
Octocat-spinner-32 test initial import February 04, 2012
Octocat-spinner-32 .gitignore initial import February 04, 2012
Octocat-spinner-32 README.md Update README.md January 16, 2013
Octocat-spinner-32 project.clj 0.2.4 - computed values and (crate.core/raw ..) for using strings of … January 16, 2013
README.md

crate

Crate is a ClojureScript implementation of the awesome Hiccup html templating library.

Usage

(ns myapp
 (:use-macros [crate.def-macros :only [defpartial]])
 (:require [crate.core :as crate]))

(crate/html [:p.woot {:id "blah"} "Hey!"])
=> <p class="woot" id="blah">Hey!</p>

(defpartial header []
 [:header
   [:h1 "My app!"]])

(header)
=> <header><h1>My app!</h1></header>

Differences from Hiccup

  • The crate.core/html returns dom nodes instead of strings of html
  • You can use dom nodes in element bodies like this:
(crate/html [:div (crate/raw "<span>foo</span><strong>bar</strong>")])
=> <div><span>foo</span><strong>bar</strong></div>

License

Copyright (C) 2011 Chris Granger

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.