1
votes

I have been trying to follow the tutorials as best as I can but for the life of me can't seem to get live reloading to work

my directory structure is as follows:-

/resources
 |------/public
         |------/css
         |------/js
                 |---- main.cljs.edn
/src
|----/app2
      |---- server.clj
|----/cljs
      |-----/scripts
             |------- client.cljs
             |------- dev.cljs

I have the following build.boot

(set-env!
 :source-paths #{"src/cljs"}
 :resource-paths #{"resources/public"}

 :dependencies '[
     [adzerk/boot-cljs "1.7.170-3" :scope "test"]
     [adzerk/boot-cljs-repl "0.3.2" :scope "test"]
     [com.cemerick/piggieback "0.2.1" :scope "test"]
     [weasel "0.7.0" :scope "test"]
     [org.clojure/tools.nrepl "0.2.12" :scope "test"]
     [pandeiro/boot-http "0.7.3" :scope "test"]
     [adzerk/boot-reload "0.4.12" :scope "test"]
     [tailrecursion/boot.ring "0.2.1" :scope "test"]
     [org.clojure/clojure "1.8.0"]
     [org.clojure/clojurescript "1.9.89"]
     [ring/ring-core "1.5.0" :scope "test"]
     [ring/ring-jetty-adapter "1.5.0" :scope "test"]
     [enfocus "2.0.0-SNAPSHOT"]
    ])

(require
  '[adzerk.boot-cljs :refer [cljs]]
  '[pandeiro.boot-http :refer [serve]]
  ;;'[tailrecursion.boot.task.ring :as ring]
  '[adzerk.boot-reload :refer [reload]]
  '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl repl-env]])

  (deftask dev []
  (comp
        (watch)
        (reload :port 9001 :on-jsload 'scripts.dev/refresh)
        (cljs-repl :nrepl-opts {:port 9000})
        (cljs :ids #{"js/main"} :source-map true :optimizations :none)
        (serve :dir "resources/public" :port 3000)
        (target :dir #{"target"})
        ))

my process output seems to be ok

Writing adzerk/boot_reload/init653.cljs to connect to ws://localhost:9001... Writing boot_cljs_repl.cljs...

Starting file watcher (CTRL-C to quit)...

Adding :require adzerk.boot-reload.init653 to main.cljs.edn... nREPL server started on port 9000 on host 127.0.0.1 - nrepl://127.0.0.1:9000 Adding :require adzerk.boot-cljs-repl to main.cljs.edn... Compiling ClojureScript... ? js/main.js 2016-07-23 02:38:50.287:INFO::clojure-agent-send-off-pool-0: Logging initialized @51878ms 2016-07-23 02:38:50.450:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310 2016-07-23 02:38:50.501:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@4451c4ae{HTTP/1.1}{0.0.0.0:3000} 2016-07-23 02:38:50.506:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @52097ms Started Jetty on http://localhost:3000 Writing target dir(s)... Elapsed time: 33.710 sec

I go to the URL...everything checks out. Then I tried updated the .cljs and .html files but nothing....no reload refresh updates unless I manually reload the browser myself

I just don't get it...how is this suppose to work? What am I doing wrong?

1

1 Answers

1
votes

I don't think you are doing anything wrong... I took your posted code and it works for me. Here is a zip of the files:

https://drive.google.com/file/d/0BxSVa_-SDW_eaXpRSlE1aFpqdjA/view?usp=sharing

When I change the code, it reloads. When I change the HTML it does not (perhaps additional config is needed for html?)

Anyhow I hope that helps and shows that you are close :)

I suggest checking the main.cljs.edn file and source that were not listed, maybe there are some differences there.

Let me know if it's still not working.

Also I suggest looking at the developer console for error messages!