Fork me on GitHub

So, bit of an odd question: I’d like to use (a macro that uses io and slurp) to inline a big JSON file into a cljs project. The inlining macro part works fine, but I’d also like to parse the file from JSON into clojure data structures/EDN at compile-time. That requires an external dependency, but only for clojure (not clojurescript) and only at compile-time. Is there a way to specify clojure compilation dependencies separately from clojurescript dependencies? A lot of the clojure JSON parsers rely on Java libraries and I suspect things would get mad if I specified them as normal clojurescript dependencies. I’m using shadow-cljs (I think that matters?)


Things won't get mad. :)


So I just mix it in with my normal clojurescript dependencies and everything will figure itself out?


If something somehow blows up, it would likely deserve a minimal reproducible example shared in #shadow-cljs

thanks3 3

FWIW you should absolutely avoid inlining larger files into a build this way. the source compiled variant of edn will be much larger than the original edn and bloat your bundle size. ideally load data at runtime instead.


Inlining the JSON string should be fine though?


totally depends on the size. you don't want to inline 1mb of json. 1kb is fine.


Depends on the use case also. Browsers have not been mentioned so it might be a toaster.


Good to know! In this particular case, I’m trying to create a single-html-file application to ease distribution of an application and I’m not actually serving it over the web, so size isn’t much of a concern. But it’s good to know that EDN compiles larger than the equivalent string. Thanks for the tip!


yeah it would still be better to just inline the edn string and parse it at runtime


Are there any resources I can look at for how to integrate Clojurescript into a pre-existing JS codebase?


Specifically it is a React + Reframe codebase


Am doing a ClojureScript project for my final year project and will be discussing with my ex-colleague (doing my capstone project with a company I interned at) , how the integration pathway might be like if our work is something they want to integrate back into their js codebase


I don't have any personal experience doing that. If you're not using shadow-cljs, consider using it, and then this link could be useful:


Hmmm that seems to work :thinking_face:


I guess reagent components could be accessed via this too hmmm


How do I convert the lein template like lein new reagent myproject from lein-figwheel to figwheel-main ?


Also, does it make sense to use shadow-cljs as a compilation target and figwheel main as the repl type? I don't really understand where shadow fits into this


no, you use either shadow-cljs or figwheel. not both. shadow-cljs also provides repl and hot-reload and so on


@zackteo - It would be easier to create project first then add figwheel-main as described in it's documentation.



lein new figwheel-main myproject -- --reagent


Is there a straightforward way to override toString on my records?


I found a message on the google group talking about this, but what is suggested seems to have no effect.


Oh :o right. Might something like this be a good starting point then ?


Or maybe this just that I should remove the proto-repl dependency :thinking_face: cause im using cider and my friends are using calva


I find templates often just lead to more trouble because then I don't understand the build at all.


agreed. I think everyone should go through a quickstart like tutorial at least once. be it cljs, figwheel or


getting to know the parts involved is essential and templates often invite you to skip those parts just to get you going a little quicker. which in the long run isn't ideal IMHO