Liking cljdoc? Tell your friends :D

Boot-cljs compiler options

Boot-cljs does some special handling with some of ClojureScript compiler options, these cases are either related to Boot temp dir and fileset architecture, or to support some additional features of Boot-cljs.

Example of first case is :output-to and :output-dir. These filepaths need to be under temp directory managed by Boot-cljs.

Example of second case is :main namespace. Boot-cljs writes it's own main namespace because we need to support multiple :require namespaces from .cljs.edn files. This is important because other tools (boot-reload) use :require to initialize themselves.

Merge order

  1. :compiler-options in .cljs.edn file
  2. :compiler-options task option
  3. :optimizations and :source-map task options
  4. options automatically set by boot-cljs (:output-dir, :output-to, :main)

TODO: add support for merging :closure-defines and other map options #135

:output-dir & :output-to

If these options are set, path of Boot-cljs temp dir is prepended into these.

If values are not set, default value is created based on relative path of the .cljs.edn file.

  • resources/js/main.cljs.edn
    • :resource-paths #{"resources"}
    • relative path of the file inside fileset is js/main.cljs.edn
    • :output-dir is set to js/main.out
    • :output-to is set to js/main.js

:main

This value is always set to namespace generated by Boot-cljs, e.g. boot.cljs.main31649, where the number is generated with gensym.

If user provides :main option, the namespace is appended to :require .cljs.edn option, and is thus required by the Boot-cljs main namespace. This should usually work nearly the same as without Boot-cljs main namespace, but this keeps the support for Boot-reload and others to use :require.

Note: It would be possible for Boot-reload to use :preloads instead of :require, but that would change the loading order and cause problems with current implementation of Boot-reload (check #143 for some information.)

:source-map

This option can be provided task option or as compiler-option. If :optimizations is not :none and :modules is not used, :source-map is automatically set to :output-to with .map prepended.

:modules

Should work similar to :output-to. If user provides a value, it is prepended with path to Boot-cljs temp dir, else default value is created based on relative path of .cljs.edn file and name of the module.

:output-wrapper

When doing :optimization :advanced build, if :output-wrapper is nil it is set enabled. This follows Lein-cljsbuild.

See more: #64

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close