github thheller/shadow-cljs 2.2.14
2.2.14 - live-reload config via metadata

latest releases: 2.11.23, 2.11.22, 2.11.21...
6 years ago

In addition to the usual :devtools hooks into the live-reload process via :before-load and :after-load it is now possible to configure this via metadata in code. Making the shadow-cljs.edn config for this optional.

The old way

{...
 :builds
 {:app {...
        :devtools {:after-load my.app/on-jsload}}}

Can now be done via

(ns my.app)

(defn ^:dev/before-load my-before-hook []
  (js/console.log "I was called before any code was loaded"))

(defn ^:dev/after-load-async my-before-async-hook [done]
  (js/console.log "I was called before any code was loaded")
  (js/setTimeout done 250)

(defn ^:dev/after-load my-after-hook []
  (js/console.log "I was called after all code was loaded"))

(defn ^:dev/after-load-async my-after-async-hook [done]
  (js/console.log "I was called after all code was loaded")
  (js/setTimeout done 250)

Multiple hooks are allowed and will execute in load order meaning sources that are loaded first will execute their after-load hooks first and before-load last. The async variants will receive one callback fn which they must call when their work is done.

Don't miss a new shadow-cljs release

NewReleases is sending notifications on new releases.