I’m trying to create a very dumb task that just opens a browser at the end of the build to avoid me to open it manually. Think “http://localhost:3000”. This url is served by boot-http and embeds the clojurescript I’m developing.
I’ve tried many variations of this, without success:
(require '[clojure.java.browse :refer [browse-url]])
(deftask open-browser
"Open a url in a web browser"
[u url VAL str "url to open"]
(with-post-wrap fileset
(browse-url url)))
Tried with-pre-wrap
, _
instead of fileset
since I don’t use it at all, then positioning the task call in several places of the comp
chain, that looks like this:
(deftask dev
"Compile a standalone ready-to-use js file."
[]
(comp
(serve :dir "out")
(watch) ;; tried here
(cljs-repl :nrepl-opts {:port 9099})
(cljs :compiler-options {:options :elided})
(open-browser "http://localhost:3000")
(target :dir #{"out/js"}))) ;; tried here as the last task
Any help really appreciated for the lazy guy I am