Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic Hoplon integration with Garden
(ns styles.hoplon
(:require garden.compiler
hoplon.core))
(defmethod hoplon.core/do! :garden
[el _ v]
; Replace all the inline styles on an element with css generated by Garden.
; Obviously does not play nice with other methods of setting inline styles.
(let [vs (if (sequential? v) v [v])
css (garden.compiler/compile-style vs)]
(.setAttribute el "style" css)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment