How to use Calva with the re-frame template#
The re-frame template creates a shadow-cljs project, making it easy to use with Calva.
npm install- From VS Code, issue the command Calva: Start a Project REPL and Connect (a.k.a Jack-in),
ctrl+alt+c ctrl+alt+j. - Calva will auto-detect that this is a
shadow-cljsproject and ask for which build to compile. - Calva's output window will open and log some progress information.
- When prompted for which build to start, select
:app. :appis the only configured build, but the VS Code menu for this is a bit strange so make sure the:appcheckbox is really ticked before proceeding.- This will start the app, so in this workflow you don't do the Run application steps outlined below.
- When prompted for which build to connect to, select
:app.- In the View menu of VS Code, you can tell it to show the Terminal view, where you see which command the jack-in process is started with, and it's output.
Ctrl+Cin this pane will kill your app and free up all resources it has allocated.
- In the View menu of VS Code, you can tell it to show the Terminal view, where you see which command the jack-in process is started with, and it's output.
- When the app is compiled
- Open http://localhost:8280 in your browser.
- Confirm that it says Hello from re-frame. (Depending on how long the app takes to compile, you might need to reload the page a few times.)
- Open the
views.cljsfile fromsrc/<your-project-name>and issue Calva: Load/Evaluate Current File and its Requires/Dependencies.ctrl+alt+c enter.- Confirm that you are connected by adding evaluating
(js/alert "Hello from Calva")(alt+enterandctrl+enterare your friends). - Confirm that Shadow is hot reloading by changing the greeting message.
- Confirm that you are connected by adding evaluating