[英]How to setup Leiningen/ClojureScript compiler to support user scripts?
User scripts require to start with a metadata block . 用户脚本要求以元数据块开头。 How one can setup Leiningen and/or ClojureScript compiler to insert predefined metablock from eg a text file?
如何设置Leiningen和/或ClojureScript编译器从例如文本文件中插入预定义的元块?
I have tried following: 我尝试了以下方法:
; test
;; test 2
(comment test 3)
but it got stripped (probably because {:optimizations :advanced}
?). 但它被剥夺了(可能是因为
{:optimizations :advanced}
吗?)。
Please try to explain and describe your answers well, I am a total noob in Clojure and know almost nothing about Leiningen (I managed to get a simple ClojureScript build functional, but that's about it - I wanted to start learning Clojure by writing simple user scripts which I may actually use). 请尝试很好地解释和描述您的答案,我对Clojure完全不了解,并且对Leiningen几乎一无所知(我设法获得了一个简单的ClojureScript构建功能,但仅此而已-我想通过编写简单的用户脚本开始学习Clojure。我可能会实际使用)。
You can use the :preamble
option to prepend the output files with a block of data. 您可以使用
:preamble
选项在输出文件前添加一个数据块。 You can see the compiler option here (scroll down just a bit... the link to the preamble section doesn't work because there's another div that has the preamble id). 您可以在此处看到编译器选项(向下滚动一点……到前同步码部分的链接不起作用,因为还有另一个具有前同步码ID的div)。
For reference, here's the documentation: 供参考,以下是文档:
:preamble
Prepends the contents of the given files to each output file.
将给定文件的内容附加到每个输出文件。 Only valid with optimizations other than
:none
.仅对
:none
以外的优化有效。Defaults to the empty vector
[]
默认为空向量
[]
:preamble ["license.js"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.