Liking cljdoc? Tell your friends :D

hicada.compiler

Hicada - Hiccup compiler aus dem Allgaeu

NOTE: The code for has been forked like this: weavejester/hiccup -> r0man/sablono -> Hicada.

Note about :array-children? : Go read the React.createElement() function, it's very short and easy to understand. Do you see how the children are just copied from the arguments and then just put into props.children? This is exactly what :array-children? avoids. It's completely safe to do.

Dev Note: Do NOT use any laziness here! Not when generating code! Or it won't pick up the ^:dynamic config anymore!

Hicada - Hiccup compiler aus dem Allgaeu

NOTE: The code for has been forked like this:
weavejester/hiccup -> r0man/sablono -> Hicada.

Note about :array-children? :
Go read the React.createElement() function, it's very short and easy to understand.
Do you see how the children are just copied from the arguments and then just put into
props.children? This is exactly what :array-children? avoids. It's completely safe to do.

Dev Note: Do NOT use any laziness here! Not when generating code! Or it won't pick up
the ^:dynamic config anymore!
raw docstring

*config*clj

source

*env*clj

source

*handlers*clj

source

collapse-oneclj

(collapse-one xs)

We can collapse children to a non-vector if there is only one.

We can collapse children to a non-vector if there is only one.
sourceraw docstring

compileclj

(compile content)
(compile content opts)
(compile content opts handlers)
(compile content opts handlers env)

Arguments:

  • content: The hiccup to compile
  • opts o :array-children? - for product build of React only or you'll enojoy a lot of warnings :) o :create-element 'js/React.createElement - you can also use your own function here. o :wrap-input? - if inputs should be wrapped. Try without! o :rewrite-for? - rewrites simple (for [x xs] ...) into efficient reduce pushing into a JS array. o :emit-fn - optinal: called with [type config-js child-or-children] o :server-render? - defaults to false. Doesn't do any JS outputting. Still requires an :emit-fn! o :camelcase-key-pred - defaults to (some-fn keyword? symbol?), ie. map keys that have string keys, are NOT by default converted from kebab-case to camelCase! o :inline? false - NOT supported yet. Possibly in the future... o :child-config - Called for every element with [config raw-element normalized-element] to get a new configuration for element's children o :transform-fn - Called with [[tag attrs children env]] before emitting, to get transformed element as [tag attrs children]

React Native special recommended options: o :no-string-tags? - Never output string tags (don't exits in RN) o :default-ns - Any unprefixed component will get prefixed with this ns. o :child-config - (fn [config raw-element normalized-element] -> config) change processing options as hicada goes down the tree

  • handlers: A map to handle special tags. See default-handlers in this namespace.
  • env: The macro environment. Not used currently.
Arguments:
- content: The hiccup to compile
- opts
 o :array-children? - for product build of React only or you'll enojoy a lot of warnings :)
 o :create-element 'js/React.createElement - you can also use your own function here.
 o :wrap-input? - if inputs should be wrapped. Try without!
 o :rewrite-for? - rewrites simple (for [x xs] ...) into efficient reduce pushing into
                        a JS array.
 o :emit-fn - optinal: called with [type config-js child-or-children]
 o :server-render? - defaults to false. Doesn't do any JS outputting. Still requires an :emit-fn!
 o :camelcase-key-pred - defaults to (some-fn keyword? symbol?), ie. map keys that have
                         string keys, are NOT by default converted from kebab-case to camelCase!
 o :inline? false - NOT supported yet. Possibly in the future...
 o :child-config - Called for every element with [config raw-element normalized-element]
                   to get a new configuration for element's children
 o :transform-fn - Called with [[tag attrs children *env*]] before emitting, to get
                   transformed element as [tag attrs children]

 React Native special recommended options:
 o :no-string-tags? - Never output string tags (don't exits in RN)
 o :default-ns - Any unprefixed component will get prefixed with this ns.
 o :child-config - (fn [config raw-element normalized-element] -> config) change processing options as hicada goes down the tree
- handlers:
 A map to handle special tags. See default-handlers in this namespace.
- env: The macro environment. Not used currently.
sourceraw docstring

compile-configclj

(compile-config attrs)

Compile a HTML attribute map to react (class -> className), camelCases :style.

Compile a HTML attribute map to react (class -> className), camelCases :style.
sourceraw docstring

compile-config-kvcljmultimethod

source

compile-elementclj

(compile-element [tag attrs & children :as element])

Returns an unevaluated form that will render the supplied vector as a HTML element.

Returns an unevaluated form that will render the supplied vector as a HTML element.
sourceraw docstring

compile-formcljmultimethod

Pre-compile certain standard forms, where possible.

Pre-compile certain standard forms, where possible.
sourceraw docstring

compile-htmlclj

(compile-html content)

Pre-compile data structures

Pre-compile data structures
sourceraw docstring

compile-reactcljmultimethod

Compile a Clojure data structure into a React fn call.

Compile a Clojure data structure into a React fn call.
sourceraw docstring

compile-react-elementclj

(compile-react-element element)

Render an element vector as a HTML element.

Render an element vector as a HTML element.
sourceraw docstring

default-configclj

source

default-handlersclj

source

emit-reactclj

(emit-react tag attrs children)

Emits the final react js code

Emits the final react js code
sourceraw docstring

emitterclj

(emitter content)
source

tag->elclj

(tag->el x)

A :div is translated to "div" and symbol 'ReactRouter stays.

A :div is translated to "div" and symbol 'ReactRouter stays.
sourceraw docstring

to-jscljmultimethod

Compiles to JS

Compiles to JS
sourceraw docstring

with-child-configcljmacro

(with-child-config form expanded-form & body)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close