Skip to content

Instantly share code, notes, and snippets.

@willhyper
Created August 25, 2020 04:38
Show Gist options
  • Save willhyper/f45a2969d7fe135b886ed859624bd88e to your computer and use it in GitHub Desktop.
Save willhyper/f45a2969d7fe135b886ed859624bd88e to your computer and use it in GitHub Desktop.
lein new figwheel app; cd app; npm install; lein figwheel
; (base) chaoweichen@cwmbp:~/repo $ lein new figwheel app
; Generating fresh 'lein new' figwheel project.
; Change into your 'app' directory
; Install npm dependencies via 'npm install'
; Then run 'lein figwheel'
; Wait for it to finish compiling
; A browser window should open to the demo application, if not
; then open 'http://localhost:3449/index.html' in your browser
; (base) chaoweichen@cwmbp:~/repo $ cd app
; (base) chaoweichen@cwmbp:~/repo/app $ npm install
; ...
; (base) chaoweichen@cwmbp:~/repo/app $ lein figwheel
; Figwheel: Cutting some fruit, just a sec ...
; Figwheel: Validating the configuration found in project.clj
; Figwheel: Configuration Valid ;)
; Figwheel: Starting server at http://0.0.0.0:3449
; Figwheel: Watching build - dev
; Figwheel: Cleaning build - dev
; Compiling build :dev to "resources/public/js/compiled/out/index.js" from ["src"]...
; Successfully compiled build :dev to "resources/public/js/compiled/out/index.js" in 15.619 seconds.
; Figwheel: Starting CSS Watcher for paths ["resources/public/css"]
; Launching ClojureScript REPL for build: dev
; Figwheel Controls:
; (stop-autobuild) ;; stops Figwheel autobuilder
; (start-autobuild id ...) ;; starts autobuilder focused on optional ids
; (switch-to-build id ...) ;; switches autobuilder to different build
; (reset-autobuild) ;; stops, cleans, and starts autobuilder
; (reload-config) ;; reloads build config and resets autobuild
; (build-once id ...) ;; builds source one time
; (clean-builds id ..) ;; deletes compiled cljs target files
; (print-config id ...) ;; prints out build configurations
; (fig-status) ;; displays current state of system
; (figwheel.client/set-autoload false) ;; will turn autoloading off
; (figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
; Switch REPL build focus:
; :cljs/quit ;; allows you to switch REPL to another build
; Docs: (doc function-name-here)
; Exit: :cljs/quit
; Results: Stored in vars *1, *2, *3, *e holds last exception object
; Prompt will show when Figwheel connects to your application
; [Rebel readline] Type :repl/help for online help info
; ClojureScript 1.10.773
; dev:cljs.user=> (js/alert "!")
(ns app.core
(:require ))
(enable-console-print!)
(println "This text is printed from src/app/core.cljs. Go ahead and edit it and see reloading in action.")
;; define your app data so that it doesn't get over-written on reload
(defonce app-state (atom {:text "Hello world!"}))
(defn on-js-reload []
;; optionally touch your app-state to force rerendering depending on
;; your application
;; (swap! app-state update-in [:__figwheel_counter] inc)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment