使用 lein-cljsbuild 在 ClojureScript 构建中使用纯 .js 文件(Google Closure'd)

til*_*lda 5 javascript google-closure-compiler clojurescript

我想在我的 ClojureScript 项目中使用一些普通的 .js 文件。我使用 lein-cljsbuild 构建它,.js 文件是标准的 Google Closure 命名空间,带有正确的 goog.provide 声明。所以基本上我想要的是将它们合并到进入 Closure Compiler 的编译源中。那可能吗?

Mic*_*zyk 2

您应该能够将 Closure-aware JS 文件添加到构建规范中的 key:libs下::compiler

;; in project.clj
:cljsbuild {:builds [{:source-paths [...]
                      :compiler {:libs ["foo.js"]    ; <- add the libs here
                                 ...}}]}
Run Code Online (Sandbox Code Playgroud)