hodur-engine
hodur-engine copied to clipboard
Fix `init-path` for ClojureScript
This will be particularly useful for plugins such as the Visualizer for now.
The trick might involve something along the lines of a macro somewhat like this:
(defmacro inline-resource [resource-path]
(slurp (io/resource resource-path)))
Combined with ClojureScript's reader, i.e:
(cljs.reader/read-string
(inline-all-edns "schemas/editorial.edn"))
You can skip the read-string and inline the edn itself. You can change init-path to a macro
(defmacro init-path [path & others]
(let [paths (-> others flatten (conj path) flatten)
data (->> paths
schema-files
slurp-files
vec)]
`(apply init-schema (quote ~data))))