Hey,

you could take a look at shadow-build [1]. I wrote it for exactly the use case 
you describe since I had that issue myself. CLJS itself will always include all 
source files it can find in a build which leads to your issues. shadow-build 
will also discover all source files but will only include the files reachable 
by your "main" namespaces in a build/optimize.

The documentation is a bit sparse but I'd be happy to help if you have 
questions. See shadow-build-example [2] for a simple example of a minimal build 
configuration. It is just clojure code so adding another build is either just 
another function or another step in the existing function.

As for your other question: Yes you can fine-tune your build using the 
:closure-defines build option. [3] It might require a type hint though. "(when 
^boolean js/goog.DEBUG (do-debug-stuff))"

HTH,
/thomas

PS: alpha12 requires clojure-1.7 due to the .cljc support, if you don't want 
1.7 yet you can use alpha9.

[1] https://github.com/thheller/shadow-build
[2] https://github.com/thheller/shadow-build-example
[3] 
https://github.com/clojure/clojurescript/wiki/Compiler-Options#closure-defines


On Sunday, June 7, 2015 at 11:19:58 PM UTC+2, Novi Border wrote:
> Hi,
> 
> As a clojurescript newbie, especially regarding build tools, I am wandering 
> if my usecase is supported (easily:)
> 
> I am using lein cljsbuild and figwheel, and dev experience is mostly great.
> 
> I have an internal application(s) which are built from the same source tree.
> Each application has a different entry point and compiles from separate lein 
> project, but there many "pages" each used in multiple applications. 
> Since I coudn't get multiple builds to work from single confiuration file 
> and, after some frustration, I have created multiple build files, symlinking 
> to the same source folder. 
> 
> At first I have thought that the cljs/closure combination will compile-in 
> only the symbols reachable from the entry point, alas that is not working for 
> me, each final application seems to include unrelated parts of other apps in 
> the final build.
> 
> Are there debugging tools for the compiler which would help me determine why 
> some namespaces are included/excluded in the build. Now everything seems to 
> be included in each app, though the final file sizes are a bit different 
> (probably due to differences in entry points or order of renamed functions in 
> the output).
> 
> The approach with extracting some core part of the source in a library, and 
> having separate source trees is not appealing to me, because some pages are 
> shared between different combinations of output builds (currently 3, will 
> probably grow). I would really like to use the closure compiler to prune out 
> functions that are not used at all in a given build.
> 
> BTW, does closure compiler support "constant propagation" in the source 
> (similar like GWT uses), where I can turn some feature on or off in a build 
> by a simple if expression taking in a constant parameter, which would then 
> turn on code for only one branch?
> 
> Sorry for the long winded post, any directions are appreciated..
> 
> NB

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to