如何将单个文件输出到cljsbuild的指定目录 [英] how to output individual files to a specified directory for cljsbuild

查看:66
本文介绍了如何将单个文件输出到cljsbuild的指定目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用cljsbuild,我可以将所有.cljs文件编译为一个文件。但是,我希望能够选择一个目录进行输出,并将每个.cljs文件编译成自己的.js文件。

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?

推荐答案

您可以使用多个构建配置:cljsbuild接受<$ c的配置向量$ c>:builds 键,其每个元素定义用于编译单独的.js文件的规则(更多信息可以在 lein-cljsbuild自述文件)。简单示例:

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"}}]} 

这篇关于如何将单个文件输出到cljsbuild的指定目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆