https://github.com/ibdknox/crate
A ClojureScript implementation of Hiccup
https://github.com/ibdknox/crate
Last synced: 16 days ago
JSON representation
A ClojureScript implementation of Hiccup
- Host: GitHub
- URL: https://github.com/ibdknox/crate
- Owner: ibdknox
- Created: 2012-02-04T21:34:53.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2015-11-02T21:08:01.000Z (about 10 years ago)
- Last Synced: 2025-04-17T11:50:21.994Z (7 months ago)
- Language: Clojure
- Homepage:
- Size: 236 KB
- Stars: 220
- Watchers: 13
- Forks: 27
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-clojurescript - Crate
README
# crate
Crate is a ClojureScript implementation of the awesome [Hiccup](https://github.com/weavejester/hiccup/) html templating library.
## Usage
```clojure
(ns myapp
(:use-macros [crate.def-macros :only [defpartial]])
(:require [crate.core :as crate]))
(crate/html [:p.woot {:id "blah"} "Hey!"])
=>
Hey!
(defpartial header []
[:header
[:h1 "My app!"]])
(header)
=>
My app!
```
## 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:
```clojure
(crate/html [:div (crate/raw "foobar")])
=>
foobar
```
## License
Copyright (C) 2011 Chris Granger
Distributed under the Eclipse Public License, the same as Clojure.