- The enclosed directory hello.world can be run inside of Edge, see directions there.
- Docker integration needs to be added.
- The system is otherwise feature complete with regard to the objectives below.
- Documentation below is notional.
Spin up a minimal demonstration of a CIDER refreshable application.
To make a reasonable comparison with Figwheel, this will be a web app.
Let's make a website where we click a button to say "Hello ______
".
We can then:
- Change who is being greeted in the frontend.
- Change what the greeting says in the backend.
- Witness the reloading.
Let's also make this inside a docker container to approximate a standard industry workflow.
- CIDER
- lein
- docker
docker-compose up
Browse to localhost:8070
- Make code change in a clj or edn file and press M-x
cider-ns-reload
RET. - Make code change in a cljs file and reload the page?
.dir-locals.el
is a configuration for Emacs contains instructions
for stopping and starting the system using
integrant.repl.
Note, you will have to interactively accept the use of local variables inside Emacs.
((nil . ((cider-ns-refresh-before-fn "integrant.repl/suspend")
(cider-ns-refresh-after-fn "integrant.repl/resume")))))
Alternatively we could have defined these variables system-wide inside of
.emacs
.
We will define the system itself using Integrant, but similar functionality exists for Component.
system_config.edn
contains the outline of the systemcore.clj
loads the system
user.clj
configures the REPL
Inside user.clj
, we set clojure.tools.namespace/set-refresh-dirs
to constrain which directories are scanned at the refresh stage.
This looks good:
Here are some additional relevant bits of documentation about reloading
- http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/refresh
- https://github.com/clojure/tools.namespace#reloading-code-preparing-your-application
- http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
- https://lambdaisland.com/blog/2018-02-09-reloading-woes
- clojure-emacs/cider-nrepl#503
Notable things:
-
"Reloading code does not work in the presence of AOT-compiled namespaces."
-
"Either keep your REPL in a namespace which has no file associated with it, such as
user
, or put all your REPL definitions in a file so that they can be reloaded."
Saturday, 21:31: Leaving off with something sketched but not working
- How to set up Jetty https://github.com/ring-clojure/ring/wiki/Getting-Started
- Integrant via Edge https://juxt.pro/edge/docs/setup.html (maybe this would have everything I need for a basic example)