简体   繁体   English

如何设置Leiningen / ClojureScript编译器以支持用户脚本?

[英]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.

相关问题 ClojureScript Leiningen编译为单个.js文件? - ClojureScript Leiningen compile to a single .js file? leiningen - 如何为本地jar添加依赖项? - leiningen - how to add dependencies for local jars? 如何使用leiningen使用当地罐子开发? - How to use leiningen to develop using local jars? 将 GCC 构建为具有多库支持的 ARM 交叉编译器 - Building GCC as an ARM cross compiler with multilib support Unity Error building Player 因为脚本有编译器错误 - Unity Error building Player because scripts had compiler errors Leiningen两步建造:如何结合无lein和lein-asset-minifier - Leiningen 2-steps build: how to combine lein-less and lein-asset-minifier 删除setup.py中的所有默认编译器参数 - Remove all default compiler arguments in setup.py 用于C ++ 11支持的错误编译器版本的存储库 - Repository of buggy compiler versions for C++11 support 如何在 Clojure/ClojureScript 项目上解释 for:cljsbuild 的这种安排? 以及如何扩展它以进行持续部署? - How to explain this arrangement for :cljsbuild on a Clojure/ClojureScript project? And how to extend it for Continuous Deployment? 如何在makefile中指定编译器? - How to specify compiler in makefile?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM