So, I took my large Clojure project and split it into two.
I compiled the core part and made an Uberjar.
Then typed :
lein deploy clojars
to make that jar public, and then added it as a dependency in the project.clj file for my application.
This code is written in cljx so it can compile to javascript.
What are the equivalent steps I need to make my two cljx codebases into two separate javascript libraries, without having the whole ClojureScript virtual machine repeated twice?
Update : Just to clarify a couple of things.
1) I know I can move to .cljc rather than .cljx. My only concern is that this seems pretty new and I don't know if existing users of my code are likely to have it. But I probably will make this move shortly. Answers in terms of cljc are also welcome.
2) I am already successfully compiling my code to a single monolithic main.js file. What I'm looking for is how to compile separate libraries of cljs that can be included in other cljs projects. As every time I currently compile something in cljs I get a main.js file with the entire clojurescript VM.
3) One of my motivations for coming back to this question is that I want to start using Figwheel. So I want to be able to make libraries in clojurescript that I can drop into a new clojurescript project I'm developing through Figwheel. So I imagine I'd be referencing them in this new project's project.clj file, and including them within the web-page as already compiled .js files. Am I wrong about this?
project.clj
from both projects. There are multiple things that can go wrong in a .cljx configuration::output-path
,:source-path
,:resource-path
, also how you declare the dependency (using:aot
could be a problem), if you are callingcljx once
beforedeploy clojars
or not... – nberger