-
-
Save metacritical/4f69cd0a29861b63563f43ff65b0e83a to your computer and use it in GitHub Desktop.
How to use slurp from ClojureScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.core | |
(:refer-clojure :exclude [slurp])) | |
(defmacro slurp [file] | |
(clojure.core/slurp file)) | |
;; In CLJS | |
(ns bar.core | |
(:require [foo.core :include-macros true :refer [slurp]])) | |
;; This is possible because we can evaluate *Clojure* code at compile time. | |
(def project-clj | |
(slurp "project.clj")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't understand how this works though, doesn't
clojure.core/slurp
usejava.io
stuff? But that's not available in Node.js or the web browser.