an enhancement of using hickory to generate reagent style hiccup
(:require-macros [reagent-hickory.templates :refer [deftemplate deftemplatefn]])
(:require [reagent-hickory.sweet :refer [html->hiccup]])
user=> (html->hiccup "<p class='someclass'><span>I have </span><strong>bold</strong><span style='color:red'> and red </span><span>text.</span></p>")
[:p {:class "someclass"} [:span {} "I have "] [:strong {} "bold"] [:span {:style {"color" "red"}} " and red "] [:span {} "text."]]
put you html file in src/templates/
user=> (deftemplate component "component.html") ;;#'component can put in any reagent capatible hiccup structure
user=> component
[:p {:class "someclass"} [:span {} "I have "] [:strong {} "bold"] [:span {:style {"color" "red"}} " and red "] [:span {} "text."]]
user=> (deftemplatefn componentfn "component.html")
user=> (componentfn)
[:p {:class "someclass"} [:span {} "I have "] [:strong {} "bold"] [:span {:style {"color" "red"}} " and red "] [:span {} "text."]]
Phantomjs 2.0.0 or above installed required
lein run-tests
Copyright © 2016 zjhmale
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close