I need a way to parse HTML markup to hiccup on a node.js app written in Clojurescript. On the client side I used hickory for the job, which unfortunately doesn't play nice on Node.js. If any namespace requires hickory.core
node refuses to run the app saying
ReferenceError: Node is not defined
at hickory$core$node_type (/media/lapdaten/ARBEITSSD/dev/violinas_macchiato/target/out/hickory/core.cljs:35:1)
at Object.<anonymous> (/media/lapdaten/ARBEITSSD/dev/violinas_macchiato/target/out/hickory/core.cljs:39:16)
If I hot-load the library with figwheel while node is already running CIDER gives me code completion for the various hickory functions, but hickory.core/parse-fragment
is undefined at runtime (hickory.core/as-hiccup
being available for some reason).
This is actually a known problem with hickory because it depends on a browser DOM API, which is unavailable in Node.js. I tried (set! js/DOMParser (.-DOMParser (js/require "xmldom")))
as suggested on GitHub, but I don't actually know where to put that expression. Generally the discussions on GitHub left me without a clue…
Has anyone gotten hickory to work on Node.js? Any other suggestions as to how I may have my app convert HTML to hiccup?
Many thanks in advance!
Oliver