如何自动重新加载Clojure代码? [英] How to automatically reload Clojure code?

查看:191
本文介绍了如何自动重新加载Clojure代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何自动重新载入 Clojure 代码?

How to automatically reload Clojure code?

我观看了演示文稿。在那里,他们使用一些热插拔Clojure技术,当对源文件进行更改时重新加载代码。我可以运行代码,但我不能观察自动重新加载的效果。如何重新加载代码?

I have watched the presentation. And in there they use some hot swap Clojure technology that reloads code whenever changes are made into source files. I can run the code, but I can not observe the effect of auto reload. How is it possible to reload the code?

源代码。

the source code.

推荐答案

根据情况,有很多方法可以重载代码:

There are many ways to reload code, depending on the situation:

  • Emacs/CIDER shortcuts to reload a file. Probably Rich is doing something similar. Also see this: How to reload a clojure file in REPL
  • watch files and reload the code (figwheel for frontend development does that, test plugins as well as CIDER shortcuts specifically for running tests, boot has a watch task...)
  • a middleware for the web server you use (ring has ring.middleware.reload/wrap-reload for this, pedestal comes with one as well, other webservers like yada play well with component)
  • a component workflow works also, there is an example of an auto-reloadable system with holy-grail

这篇关于如何自动重新加载Clojure代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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