Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mynomoto/c9110cadd08721d0cd20d63623c603a5 to your computer and use it in GitHub Desktop.
Save mynomoto/c9110cadd08721d0cd20d63623c603a5 to your computer and use it in GitHub Desktop.
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