3 ms·
Luminus provides ClojureScript support out of the box along with documentation on how to use it. It's been around for years now, and the primary goal is to prov
by yogthos 8y ago
Luminus provides ClojureScript support out of the box along with documentation on how to use it. It's been around for years now, and the primary goal is to provide a smooth beginner experience:
http://www.luminusweb.net/docs/clojurescript.html http://www.luminusweb.net/docs/clojurescript.html
You can create a new project with Clojure/Script support by adding different flags. For example, for a re-frame project:
lein new luminus myapp +re-frame
This will generate the needed boilerplate and configuration. You can now start the server by running:
lein run
The server will start a nREPL that you can connect the editor to on port `7000`, this is defined in the `my-dev-config.edn` file. The typical workflow is to connect to the REPL, and run your code as you're writing it.
Next, you start ClojureScript compiler in a separate terminal with:
lein figwheel
The front-end workflow typically involves having figwheel running while you write the code, and it will automatically push changes to the browser. You can also connect to the nREPL started by Figwheel from the editor. This port is specified in `project.clj` under `:figwheel` with the `:nrepl-port` key. The default is `7002`. Once you connect the editor you run `(cljs)` function to switch to the ClojureScript REPL. You can now evaluate any code that's running in the browser. Note that Figwheel has to be started, and the page loaded in the browser first.
The project is set up to keep all the code in the same repository, and you have three separate source paths:
* `clj` - server-side code
* `cljc` - code shared between the server and the client
* `cljs` - client-side code
Packaging the app is done by running
lein uberjar