3

I am using enlive for my web development. I start my ring server in repl using (serve my-app/handler)

However when I make changes to any of my html templates I have to restart my repl for the changes to show up. How do I reload my markup without restarting the repl ?

Thanks, Murtaza

murtaza52
  • 46,887
  • 28
  • 84
  • 120

1 Answers1

3

You need to reevaluate lines that read the template. For example in my project I would have to reevaluate ("C-x C-e" in Emacs) the following line:

(def table-template (h/html-resource "META-INF/web/table.html"))

If you don't use Emacs you could try require namespace that contains templates with :reload, please see this: force clojure :reload

Community
  • 1
  • 1
Ivan Koblik
  • 4,285
  • 1
  • 30
  • 33
  • thanks for replying. However how do I also reload it if I am using a deftemplate - `(deftemplate chrome "mfaiz/templates/chrome.html" [page] [:#main] (content "Hello World")))` – murtaza52 Sep 10 '12 at 12:30
  • You should be able to do the same: either reevaluated this expression or entire namespace where template is defined. If you take a look at definition of [deftemplate](https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L583) it calls [template](https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L573) which in its order calls [html-resource](https://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L66). – Ivan Koblik Sep 10 '12 at 13:14