pdlug / adlibs-cljs

Ad libs in Clojurescript - demos deps.edn for cljs and keyboard nav w/ reagent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ad libs in Clojurescript

Example of how to use deps.edn and a simple build script (build.clj) to manage a cljs project rather than leinigen or boot. Structure heavily inspired by Figwheel with new Clojure 1.9 CLI tools. This is much simpler and easier to reason about then a more complex lein or boot setup. Any custom workflow can be created since it's just code, no plugins, no magic.

The example app is a simple reagent "mad libs"-like fill in the blanks app. I wasn't feeling particularly creative so it just uses some "lorem ipsum" text as a placeholder. It demos how to do keyboard navigation with reagent

Try it out here: https://demos.pauldlug.com/adlibs/

  • Enter move to next text input and reveals the hidden text if all fields have been filled out.
  • Up/down arrows move to next or previous text input
  • Escape clears all text and resets state

Usage

In development run:

clj -A:figwheel -m figwheel.main -b dev -r

Then open a browser to http://localhost:3449/ and you'll have a nice figwheel instance.

For a production build run:

clj -A:figwheel -m figwheel.main -bo prod

Deployment

Just write a script! Like this one:

#!/usr/bin/env bash

rm -rf resources/public/js/compiled
clojure build.clj compile
aws s3 sync resources/public/ s3://BUCKETNAME/PATH/

About

Ad libs in Clojurescript - demos deps.edn for cljs and keyboard nav w/ reagent


Languages

Language:Clojure 69.7%Language:CSS 19.5%Language:HTML 10.9%