Automatic code reload in Ring / Jetty

Using Ring / Jetty with Clojure, when I make any changes to my code, I need to reload the entire JVM.

Is there a way to keep Jetty asynchronous with changes in my code, so I can just refresh my browser window and change it immediately?

In particular, I use Hiccup for HTML Parsing, and that basically changes the layout I am doing.

This would be a great time if layout changes were automatically compiled and available in the browser upon update.

Does anyone have any info on this? Are there any solutions?

+5
source share
3 answers

, lein-ring, :auto-reload? :auto-refresh?.

+8

, , emacs + nrepl ( , , , ), . IMO - , + (-) . emacs/nrepl.el, .

+7

lein-ring?

Here is an example project.clj:

(defproject tutorial1 "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repl-options {:port 11111}
  :plugins [[lein-ring "0.8.8"]]
  :ring {:handler tutorial1.core/handler
          :auto-reload? true
          :auto-refresh? true
          }
    :dependencies [[org.clojure/clojure "1.5.1"]
                  [ring/ring-core "1.2.1"]
                    [ring/ring-jetty-adapter "1.2.1"]
                    [ring-refresh "0.1.1"]])
+1
source

All Articles