My personal website, written with re-frame in Clojure(script), and hosted on AWS Amplify.
core.cljs- initiates the application by mounting the root element
db.cljs- defines initial DB state
events.cljs- effects caused by events
routes.cljs- pages and their routes
styles.cljs- styling, CSS
subs.cljs- link effects to subscriptions
views.cljs- views, and their subscriptions
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 appPlease 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.
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 ciPlease 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 watchThen in another terminal:
karma startSee a list of =shadow-cljs CLI= actions:
npx shadow-cljs --helpPlease 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> appThe debug? variable in
=config.cljs=
defaults to true in =dev= builds, and false in
=prod= builds.
Use debug? for logging or other tasks that should run only on dev
builds:
(ns ae.almost-education.example (:require [ae.almost-education.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 releasePlease 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 and manifest.edn files.