Create build fileλ︎
As ClojureScript is a Clojure library, a simple build tool can be easily scripted in a few lines of Clojure.
Create a file called build.clj
in the cljs_compiler
directory and add the following Clojure code:
Hint In order to compile the ClojureScript code, we use the
build
function from the librarycljs.build.api
. To access the functions of this library we use therequire
function. This is similar to import or include in other languages.
The cljs.build.api/build
function takes two arguments: the directory to compile and a map of options. In our code we include the option :output-to
that specifies where to write the JavaScript.