Skip to content

Instantly share code, notes, and snippets.

@thedavidmeister
Created November 26, 2016 05:45
Show Gist options
  • Save thedavidmeister/68cf53456c61c37a33331d06008c4940 to your computer and use it in GitHub Desktop.
Save thedavidmeister/68cf53456c61c37a33331d06008c4940 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