Skip to content

aelfsyg/aelfsyg.com

Repository files navigation

æ/almost.education

My personal website, written with re-frame in Clojure(script), and hosted on AWS Amplify.

Structure

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

Development

Running the App

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.

Running Tests

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

Running shadow-cljs Actions

See 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

Debug Logging

The 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."))

Production

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 and manifest.edn files.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors