Skip to content

Instantly share code, notes, and snippets.

@bhauman
Last active April 30, 2022 17:16
Show Gist options
  • Save bhauman/a5251390d1b8db09f43c385fb505727d to your computer and use it in GitHub Desktop.
Save bhauman/a5251390d1b8db09f43c385fb505727d to your computer and use it in GitHub Desktop.
Base Figwheel Main example

Minimal Figwheel Main project

This is the base example project that is the assumed a starting point for most of the examples in the Figwheel Main documentation.

You can run it with the Clojure Tools in your terminal via:

$ clj -m figwheel.main -b dev -r

The project.clj file is only needed if you are using Leiningen. You can start the build with Leinigen via:

$ lein fig:build

The above commands will start a process that watches and compiles the ClojureScript source along with a REPL. When you edit the src/hello_world/core.cljs file it will be hot reloaded into the browser.

Learn more at: figwheel.org

;; This file is only needed when using Clojure CLI Tools
{:deps {org.clojure/clojurescript {:mvn/version "1.10.773"}
com.bhauman/figwheel-main {:mvn/version "0.2.6"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}
:aliases {:fig {:main-opts ["-m" "figwheel.main"]}}
:paths ["src" "resources" "target"]}
{:main hello-world.core}
;; This file is only needed for use with Leinigen
(defproject example-project "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.9.0"]]
:profiles
{:dev
{:dependencies [[org.clojure/clojurescript "1.10.773"]
[com.bhauman/figwheel-main "0.2.6"]
;; exclude on Windows
[com.bhauman/rebel-readline-cljs "0.1.4"]]
:resource-paths ["target"]
:clean-targets ^{:protect false} ["target"]}}
;; remove the string "trampoline" below if you are using Windows
:aliases {"fig:build" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]})
;; place this file in `src/hello_world/core.cljs`
(ns hello-world.core)
(js/console.log "Hello there world!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment