What I've Already Tried
(defmacro magic []
(slurp *file*))
This works fine in clojure, but not in clojurescript (atleast not with lein figwheel).
Original Question
I need the following to work in both Clojure and Clojurescript. I think a macro is the right solution, but I'm open to other techniques.
I want a way to read the current file as a string. For example,
(ns my-test
(:require blah))
(def foo 20)
(println (blah/magic))
this should then result in (being printed out)
(ns my-test
(:require blah))
(def foo 20)
(println (blah/magic))
If I only needed this to work in Clojure, I could do funny things with the current file and reading it at run time. However, I need this also to work in Clojurescript (and I don't want to setup some REST API to serve *.cljs files) -- thus, is there some way to do this at compile time via some macro?
Clarification
Suppose you wanted to write a "cheating quine" -- how would you do it? Probably something like (println (slurp *file*)). Now, what's the problem? This doesn't work in clojurescript when running under lein figwheel.