user1028880
user1028880

Reputation:

lein-cljsbuild source-cljs dir -> output-js dir?

Looking at cljsbuild doc https://github.com/emezeske/lein-cljsbuild

:cljsbuild {
    :builds [{
        ; The path to the top-level ClojureScript source directory:
        :source-paths ["src-cljs"]

        :compiler {
          :output-to "war/javascripts/main.js"  
            ; default: target/cljsbuild-main.js

it requires

:source-paths as a directory

:output-to as a js-file

Why not source dir -> output dir??

How do we manage many source files to be compiled to many output files?

Is there any configuration to map *.cljs @sourceDir -> *.js @targetDir ?

Upvotes: 4

Views: 757

Answers (3)

micimize
micimize

Reputation: 944

You'll still need an :output-to, but I think you're looking for the :output-dir option.

Upvotes: 0

deterb
deterb

Reputation: 4014

It is possible to get multiple output files, just use multiple builds

Keep in mind the code is meant to run through the Google Closure compiler, which not only reduces the file count down to 1 (which is more efficient for the browser to download), but also removes a huge amount of redundancy in the code. It also ensures that files are loaded in the correct order.

If you don't want any inlining, you can set the :optimizations option to :none (as compared to :whitespace, :simple, or :advanced. That may get you something closer to what you want. Make sure you check the target directory for temporary files which may be what you are after.

Upvotes: 4

VFe
VFe

Reputation: 223

I can't speak for the author, but I imagine it has to do with a couple things.

  1. Having a single output makes things like cljsbuild auto more manageable.

  2. Well I can see some limited use case for multiple input paths, multiple output files seems counter to browser efficiency? Where you basically want a single highly optimized .js file for optimum download speeds.

If you needed multiple .js files from multiple .cljs builds that aren't really related, that's essentially a different project already.

Upvotes: 1

Related Questions