Clojure: update a running web application when changing html files

I created my lane ring project to reload the hot code. It works when I modify any .clj file while the application is running ...

How can I do the same for changes in any html, css and js files. (located in resources / public ...)

Here is my project.clj setup:

(defproject ...
  :plugins [[lein-cljsbuild "1.0.4"]
            [lein-ring "0.9.2"]]      
  :ring {:handler votepourca.server/handler
          :auto-reload? true
          :auto-refresh? true}
  :resource-paths ["resources" "markup"]
  :source-paths ["src/clj"]
  ...)

EDIT:
I am using Enlive and apparently it needs an extra ring shell to reload the static file:[com.akolov.enlive-reload "0.1.0"]

So, in my server.clj / core.clj / handler.clj I now have this and it works great!

(:require 
    [ring.middleware.reload   :refer [wrap-reload]]
    [com.akolov.enlive-reload :refer [wrap-enlive-reload]])
...

(defn app [routes]
  (-> routes 
      (wrap-params) 
      (wrap-reload)
      (wrap-enlive-reload))))

Thank you "Kolov" author of this lib https://github.com/kolov/enlive-reload

+4
1
+4

All Articles