I'm trying to write a cljs macro that transforms clojure data, e.g. {:font-size "14px"}
to CSS (font-size: 14px;
).
I want the macro to support accepting map literals as well as symbols that resolve to maps.
E.g.
(defstyles foo
{:font-size "14px"})
;; -- OR --
(def bar {:font-size "14px"})
(defstyles foo bar)
In the macro I've tried something like
(defmacro defstyles [vsym]
@(resolve vsym))
This seems to work when the var is defined in the same ns that the macro is used, but fails with a NullPointerException when passing a var from another ns.