Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to output individual files to a specified directory for cljsbuild

Using cljsbuild, I can compile all my .cljs files to one file. However, I wish to be able to pick a directory for output and have each .cljs file compile into its own .js file. How can this be specified?

like image 786
zcaudate Avatar asked Oct 21 '22 12:10

zcaudate


1 Answers

You can use 'multiple build configurations': cljsbuild accepts a vector of configurations for :builds key, each element of which defines rules for compiling separate .js file (more info could be found in lein-cljsbuild README). Simple example:

:cljsbuild 
{:builds 
 [;; Config for first .js file
  {:source-paths ["dir-with-cljs-for-first-js"]
   :compiler {:output-to "dir-for-js/first.js"}
  ;; Config for second .js file
  {:source-paths ["dir-with-cljs-for-second-js"]
   :compiler {:output-to "dir-for-js/second.js"}}]} 
like image 96
gsnewmark Avatar answered Nov 01 '22 12:11

gsnewmark