简体   繁体   English

Clojurescript为节点自编译

[英]Clojurescript self compilation for node

I've been following along the clojurescript self compilation news, including most recently http://www.yogthos.net/posts/2015-11-12-ClojureScript-Eval.html 我一直在关注clojurescript自编辑新闻,包括最近的http://www.yogthos.net/posts/2015-11-12-ClojureScript-Eval.html

Would a similar approach work with nodejs as a target? 类似的方法是否可以将nodejs作为目标? Although the bootstrapped REPL is very cool, I'm interested in compiling (or otherwise making executable) cljs files with node. 虽然bootstrapped REPL非常酷,但我有兴趣用节点编译(或以其他方式制作可执行文件)cljs文件。 I'm hoping this would make writing and running clojure(script) scripts on old / embedded hardware a less painful experience in terms of JVM startup time and memory consumption. 我希望这会使旧/嵌入式硬件上的编写和运行clojure(脚本)脚本在JVM启动时间和内存消耗方面减少痛苦。 Is this a reasonable hope? 这是一个合理的希望吗? How would I go about producing such an executable from cljs source? 我如何从cljs源生成这样的可执行文件? Thank you for your input. 谢谢您的意见。

Check out https://github.com/kanaka/cljs-bootstrap 查看https://github.com/kanaka/cljs-bootstrap

This can easily be installed via npm install -g cljs-repl . 这可以通过npm install -g cljs-repl轻松安装。 After doing that you can run a *.cljs file via cljs foo.cljs . 完成后,您可以通过cljs foo.cljs运行*.cljs文件。

I suppose it should work with node.js w/o problems but do you need self-hosting at all? 我想它应该与node.js没有问题,但你需要自我托管吗? How about compiling it locally and shipping compiled js (with optimization set to none)? 如何在本地编译它并运送已编译的js(优化设置为无)?

If it is an option, this may be helpful: https://github.com/bhauman/lein-figwheel/wiki/Node.js-development-with-figwheel 如果是一个选项,这可能会有所帮助: https//github.com/bhauman/lein-figwheel/wiki/Node.js-development-with-figwheel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM