Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix init-path for ClojureScript #3

Open
luchiniatwork opened this issue Nov 14, 2018 · 1 comment
Open

Fix init-path for ClojureScript #3

luchiniatwork opened this issue Nov 14, 2018 · 1 comment

Comments

@luchiniatwork
Copy link
Collaborator

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"))
@pkpkpk
Copy link

pkpkpk commented Nov 15, 2018

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))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants