A Leiningen template for a clojure deps project with shadow-cljs, sass and some tooling.
lein new shadow-cljs-sass my-project
Minimal project giving a react, reagent and shadow-cljs setup ready to go.
clojure
command line tools. on MacOS with homebrew this is usually as simple as brew install clojure
.npm install
make dev
localhost:9966
By default, shadow-cljs
will compile the build called :frontend
, as referenced in the file shadow-cljs.edn
Once the process has booted up, it will provide an nrepl
port to the local .shadow-cljs
directory, along with other port information. You can also see which port the nrepl is listening on in the terminal - it looks like shadow-cljs - nREPL server started on port 59128
.
Configure your nrepl
as usual to connect to thiis port, and once connected, and a browser is open, you may connect to the live process in the browser with the command:
(shadow/repl :frontend)
verify that your connection is working with the command (js/alert "hi")
and observe that an alert has been opened in your browser.
To drop out of the CLJS connection enter the keyword :cljs/quit
into the repl and evaluate it. You will then be back in the JVM clojure process.
index.html
is provided and lives in the public
folder. The referenced css/main.css
will be built by the sass process. You can write pure CSS into the sass file, as sass syntax sits on top of baseline standard CSS.
JS assets will be compiled into this folder as well, but the compiled output should be ignored, like the compiled CSS.
Copyright © 2019 Dan Peddle
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close