Last active
July 28, 2019 12:22
-
-
Save dimovich/a9c21bf97fa106f6916263c595c94aa2 to your computer and use it in GitHub Desktop.
Minimal ClojureScript + Reagent + CIDER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((nil | |
(cider-clojure-cli-global-options . "-A:cider") | |
(cider-default-cljs-repl . figwheel-main) | |
(cider-figwheel-main-default-options . ":dev"))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; src/cljs/myapp/core.cljs | |
(ns ^:figwheel-hooks myapp.core | |
(:require [reagent.core :as r])) | |
(defn my-app [] | |
[:div "Hello World!"]) | |
(defn ^:after-load reload [] | |
(r/render [my-app] | |
(.getElementById js/document "app"))) | |
(defn init! [] | |
(reload)) | |
(init!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:paths ["src/cljs"] | |
:deps {org.clojure/clojure {:mvn/version "1.10.1"} | |
org.clojure/clojurescript {:mvn/version "1.10.520"} | |
reagent {:mvn/version "0.8.1"}} | |
:aliases | |
{:prod | |
{:extra-paths ["resources"] | |
:main-opts ["-m cljs.main -co prod.cljs.edn -c myapp.core"]} | |
:cider | |
{:extra-paths ["resources"] | |
:extra-deps {com.bhauman/figwheel-main {:mvn/version "0.2.0"} | |
com.bhauman/figwheel-core {:mvn/version "0.2.1-SNAPSHOT"} | |
cider/piggieback {:mvn/version "0.4.0"}}}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^{ ;;:css-dirs ["resources/public/css"] | |
:watch-dirs ["src/cljs"]} | |
{:main myapp.core | |
:output-to "resources/public/js/main.js" | |
:output-dir "resources/public/js/out" | |
:asset-path "js/out" | |
:optimizations :none} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For Development -- in Emacs, open myapp.cljs and type [C-x js] to start Figwheel | |
To compile your CLJS for Production run: | |
clj -A:prod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<div id="app"></div> | |
<script src="js/main.js" type="text/javascript"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:main myapp.core | |
:output-to "resources/public/js/main.js" | |
:output-dir "resources/public/js/out" | |
:asset-path "js/out" | |
:optimizations :advanced} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── .dir-locals.el | |
├── deps.edn | |
├── dev.cljs.edn | |
├── prod.cljs.edn | |
├── resources | |
│ └── public | |
│ └── index.html | |
└── src | |
└── cljs | |
└── myapp | |
└── core.cljs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment