Clojure live browser reload on Linux

心已入冬 提交于 2019-12-06 03:38:35

问题


Is there something like Rack-LiveReload that could be used along with a tool like Guard-LiveReload for Clojure development? I really cannot make do without live reloading now that I have used it. If there is nothing more convenient I could download the LiveReload JS file and manually include it in my app and use that with Guard-LiveReload, but I would prefer it if there was an all Clojure solution. I cannot install the LiveReload app on my machine because I am using Linux, so that is why I would need something like Guard-LiveReload.

I am new to Clojure, but so far I am going to go with Ring and Compojure, which perhaps might make a difference.


回答1:


OK, this can be done very easily, but with Grunt and https://github.com/gruntjs/grunt-contrib-watch (which has built in LiveReload support), Grunt will work with any language.




回答2:


I was poking around the c2 library and discovered the author created a liverelaod server in Clojure.

https://github.com/lynaghk/c2/tree/master/vrepl

He also has a screencast on his website. http://keminglabs.com/c2/

Grunt will probably work for you, but since you asked about a Clojure implementation I thought I would mention it.




回答3:


Imho the best and idiomatic way to go in your case could be to migrate from Ring Jetty adapter to http-kit which provides hot code reload out of the box. It also supports Websockets and it has a noticeable performance

Of course it's compatible with Ring & Compojure: HTTP Kit is a minimalist, efficient, Ring-compatible HTTP client/server for Clojure. It uses a event-driven architecture to support highly concurrent a/synchronous web applications. Feature a unified API for WebSocket and HTTP long polling/streaming



来源:https://stackoverflow.com/questions/18311341/clojure-live-browser-reload-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!