/adventure

Primary LanguageClojure

adventure

A "toy" game written with clojurescript/re-frame. Using svg and css. Some routing with secretary and other fun stuff.

I doubt the game is fun. The purpose was to learn stuff about building web apps. I think for a serious game I would use play.js or some other framework.

Kick off an nRepl and figwheel.

user> (use 'figwheel-sidecar.repl-api)
nil
user> (start-figwheel!)
Figwheel: Starting server at http://localhost:3449
Figwheel: Watching build - dev
Compiling "resources/public/js/repler.js" from ["src"]...
Successfully compiled "resources/public/js/repler.js" in 2.06 seconds.
#<SystemMap>
user> (cljs-repl)
Launching ClojureScript REPL for build: dev
...
...

To connect cider in spacemacs use: , s c.

A re-frame application designed to ... well, that part is up to you.

Development Mode

Start Cider from Emacs:

Put this in your Emacs config file:

(setq cider-cljs-lein-repl
	"(do (require 'figwheel-sidecar.repl-api)
         (figwheel-sidecar.repl-api/start-figwheel!)
         (figwheel-sidecar.repl-api/cljs-repl))")

Navigate to a clojurescript file and start a figwheel REPL with cider-jack-in-clojurescript or (C-c M-J)

Run application:

lein clean
lein figwheel dev

Figwheel will automatically push cljs changes to the browser.

Wait a bit, then browse to http://localhost:3449.

Run tests:

lein clean
lein doo phantom test once

The above command assumes that you have phantomjs installed. However, please note that doo can be configured to run cljs.test in many other JS environments (chrome, ie, safari, opera, slimer, node, rhino, or nashorn).

Production Build

To compile clojurescript to javascript:

lein clean
lein cljsbuild once min