Fork me on GitHub

How do I read files to strings in clojurescript, I need something like slurp.


I've seen this,, but it doesn't make any sense to me, does it work?


Are you targetting Node or browser?


in general @USWTQB9RU, yes the approach works - the file is read at compile time by the macro and substitutes a literal string for the value of project-clj


if you are using shadow then use shadow.resource/inline instead, for a cache-compatible approach


I've also seen this question asked in several other places online, but none give me a straight forward answer


hello! 👋 i'm running into some strange behavior, trying to use tools.deps to compile clojurescript => javascript in an existing project that i'm working on migrating from boot to tools.deps it was previously working via boot-cljs, and now i'm basically trying to detangle things and understand what's going on so that i can compile my clojurescript app in a simple, easy to understand bash script my setup is probably a little bit unusual because 1) i'm converting an existing project based on boot-cljs, (which, as i understand it, takes some liberties with cljs compilation), and 2) this is a hoplon application so, hoplon expects to find cljsjs.jquery on the classpath, and we ended up needing to use a newer version of jquery than the latest cljsjs one, so we've vendored the version of jquery we need into the project, and we have a deps.cljs that provides it as cljsjs.jquery:

{:foreign-libs [{:file "vendors/jquery/jquery.min.js"
                 :file-min "vendors/jquery/jquery.min.js"
                 :provides ["cljsjs.jquery"]}
the strange behavior that i'm running into is that this compiles successfully (in fact, it won't compile if i leave out the foreign lib entry above), but when i open the app in a browser, i get a JS console error from bootstrap saying it requires jQuery. when i look at the compiled JS file, i see other foreign libs' source at the top, but the jquery source is nowhere to be found i realize this is a lengthy and very specific problem, but does this happen to ring any bells for anyone here? any advice would be helpful a couple of related questions: 1. is there a difference between having a deps.cljs on your classpath vs. using the compiler :foreign-libs option? i couldn't find much documentation about deps.cljs, so i'm wondering if maybe i should be using the :foreign-libs compiler option instead (although i tried that and still ran into the same problem) 2. my script compiles clojurescript => javascript by invoking cljs.main with --compile-opts, --optimizations, etc. is that advisable compared to using


...aha. after posting all of that, i figured it out. in the new setup, i'm experimenting with the :modules feature, and i didn't realize that my index.html needs to include a script tag for cljs_base.js

👏 4