Code Night (CEC)
brew install leiningen
)choco install lein
)scoop install leiningen
)Re-frame template
lein new re-frame fro-cix +10x +test +kondo +cider +routes
Start a temporary local web server, build the app with the dev
profile, and serve the app,
browser test runner and karma test runner with hot reload:
npm install
npx shadow-cljs watch app
Please be patient; it may take over 20 seconds to see any output, and over 40 seconds to complete.
When [:app] Build completed
appears in the output, browse to
http://localhost:8280/.
shadow-cljs
will automatically push ClojureScript code
changes to your browser on save. To prevent a few common issues, see
Hot Reload in ClojureScript: Things to avoid.
Opening the app in your browser starts a
ClojureScript browser REPL,
to which you may now connect.
See the re-frame-template README for Calva instuctions. See also https://calva.io for Calva documentation.
See
Shadow CLJS User’s Guide: Editor Integration.
Note that npm run watch
runs npx shadow-cljs watch
for you, and that this project’s running build ids isapp
, browser-test
, karma-test
, or the keywords :app
, :browser-test
, :karma-test
in a Clojure context.
Alternatively, search the web for info on connecting to a shadow-cljs
ClojureScript browser REPL
from your editor and configuration.
Connect to the shadow-cljs
nREPL:
lein repl :connect localhost:8777
The REPL prompt, shadow.user=>
, indicates that is a Clojure REPL, not ClojureScript.
In the REPL, switch the session to this project’s running build id, :app
:
(shadow.cljs.devtools.api/nrepl-select :app)
The REPL prompt changes to cljs.user=>
, indicating that this is now a ClojureScript REPL.
user.cljs
for symbols that are immediately accessible in the REPLrequire
.Build the app with the prod
profile, start a temporary local web server, launch headless
Chrome/Chromium, run tests, and stop the web server:
npm install
npm run ci
Please be patient; it may take over 15 seconds to see any output, and over 25 seconds to complete.
Or, for auto-reload:
npm install
npm run watch
Then in another terminal:
karma start
shadow-cljs
ActionsSee a list of shadow-cljs CLI
actions:
npx shadow-cljs --help
Please be patient; it may take over 10 seconds to see any output. Also note that some actions shown
may not actually be supported, outputting “Unknown action.” when run.
Run a shadow-cljs action on this project’s build id (without the colon, just app
):
npx shadow-cljs <action> app
The debug?
variable in config.cljs
defaults to true
indev
builds, and false
in prod
builds.
Use debug?
for logging or other tasks that should run only on dev
builds:
(ns fro-cix.example
(:require [fro-cix.config :as config])
(when config/debug?
(println "This message will appear in the browser console only on dev builds."))
Build the app with the prod
profile:
npm install
npm run release
Please be patient; it may take over 15 seconds to see any output, and over 30 seconds to complete.
The resources/public/js/compiled
directory is created, containing the compiled app.js
andmanifest.edn
files.