                     #(b/by-ext [".cljs.edn"] %))]
     (-> fileset b/input-files f)))
 
+(defn- namespace-for-cljs-edn
+  [tmpfile]
+  (let [path (tmp-path tmpfile)
+        clean-name (-> (.getName (io/file path))
+                       (string/replace #"\.cljs\.edn$" "")
+                       (string/replace #"[^a-zA-Z0-9]" ""))]
+    (str "init-"
+         clean-name
+         "-"
+         (subs (digest/md5 path) 0 8))))
+
 (deftask reload
   "Live reload of page resources in browser via websocket.
 

   [boot.core          :as b]
   [clojure.java.io    :as io]
   [clojure.set        :as set]
   [boot.pod           :as pod]
   [boot.file          :as file]
   [boot.util          :as util]
   [boot.core          :refer :all]
   [boot.from.backtick :as bt]))

(def ^:private deps '[[http-kit "2.1.18"]])


   t target-path      VAL str "Target path to load files from, used WHEN serving files using file: protocol. (optional)"
   _ only-by-re REGEXES [regex] "Vector of path regexes (for `boot.core/by-re`) to restrict reloads to only files within these paths (optional)."]

  (let [pod  (make-pod)
        src  (tmp-dir!)
        tmp  (tmp-dir!)
        prev-pre (atom nil)
        prev (atom nil)
        url  (start-server @pod {:ip ip :port port :ws-host ws-host
                                 :ws-port ws-port :secure? secure
                                 :open-file open-file})]
    (set-env! :source-paths #(conj % (.getPath src)))
    (fn [next-task]
      (fn [fileset]
        (pod/with-call-in @pod
          (adzerk.boot-reload.server/set-options {:open-file ~open-file}))
        (doseq [f (relevant-cljs-edn (b/fileset-diff @prev-pre fileset) ids)]
          (let [path     (tmp-path f)
                spec     (-> f tmp-file slurp read-string)
                ns       (namespace-for-cljs-edn f)
                out      (doto (io/file src "adzerk" "boot_reload" (str (string/replace ns "-" "_") ".cljs"))
                           io/make-parents)
                in-file  (tmp-file f)
                out-file (io/file tmp path)]
            (write-cljs! out ns url ws-host (get spec :on-jsload on-jsload) asset-host)
            (add-init! ns in-file out-file)))
        (reset! prev-pre fileset)
        (let [fileset (-> fileset (add-resource tmp) commit!)
