mirror of https://github.com/status-im/reagent.git
Make geometry example use figwheel
This commit is contained in:
parent
73281cdd16
commit
86f9298c4e
|
@ -1,20 +0,0 @@
|
|||
|
||||
PROF = dev
|
||||
# PROF = dev,test,srcmap
|
||||
# PROF = prod,test
|
||||
# PROF = prod
|
||||
|
||||
CLJSBUILD = client
|
||||
|
||||
all: autocompile
|
||||
|
||||
run: openbrowser autocompile
|
||||
|
||||
openbrowser:
|
||||
(sleep 1 && open example.html) &
|
||||
|
||||
autocompile:
|
||||
lein with-profile $(PROF) cljsbuild auto $(CLJSBUILD)
|
||||
|
||||
clean:
|
||||
lein -o clean
|
|
@ -0,0 +1,7 @@
|
|||
# Reagent example app
|
||||
|
||||
Run "`lein figwheel`" in a terminal to compile the app, and then open example.html.
|
||||
|
||||
Any changes to ClojureScript source files (in `src`) will be reflected in the running page immediately (while "`lein figwheel`" is running).
|
||||
|
||||
Run "`lein clean; lein with-profile prod compile`" to compile an optimized version.
|
|
@ -0,0 +1,6 @@
|
|||
(ns devsetup
|
||||
(:require [geometry.core :as example]
|
||||
[figwheel.client :as fw]))
|
||||
|
||||
(fw/start {:on-jsload example/run
|
||||
:websocket-url "ws://localhost:3449/figwheel-ws"})
|
|
@ -2,13 +2,15 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>reagent svg example</title>
|
||||
<title>Example</title>
|
||||
<link rel="stylesheet" href="example.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="target/client.js"></script>
|
||||
<script type="text/javascript">
|
||||
<div id="app">
|
||||
<h1>Reagent example app – see README.md</h1>
|
||||
</div>
|
||||
<script src="target/client.js"></script>
|
||||
<script>
|
||||
geometry.core.run();
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
|
||||
|
||||
(defproject geometry-reagent "0.5.0-alpha"
|
||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||
[org.clojure/clojurescript "0.0-2342"]
|
||||
[reagent "0.5.0-alpha"]]
|
||||
:plugins [[lein-cljsbuild "1.0.3"]]
|
||||
[org.clojure/clojurescript "0.0-2760"]
|
||||
[reagent "0.5.0-alpha2"]
|
||||
[figwheel "0.2.3-SNAPSHOT"]]
|
||||
|
||||
:plugins [[lein-cljsbuild "1.0.4"]
|
||||
[lein-figwheel "0.2.3-SNAPSHOT"]]
|
||||
|
||||
:hooks [leiningen.cljsbuild]
|
||||
:profiles {:prod {:cljsbuild
|
||||
{:builds
|
||||
{:client {:compiler
|
||||
{:optimizations :advanced
|
||||
:preamble ^:replace ["reagent/react.min.js"]
|
||||
:pretty-print false}}}}}
|
||||
:srcmap {:cljsbuild
|
||||
{:builds
|
||||
{:client {:compiler
|
||||
{:source-map "target/client.js.map"
|
||||
:source-map-path "client"}}}}}}
|
||||
:source-paths ["src"]
|
||||
:cljsbuild
|
||||
{:builds
|
||||
{:client {:source-paths ["src"]
|
||||
:compiler
|
||||
{:preamble ["reagent/react.js"]
|
||||
:output-dir "target/client"
|
||||
:output-to "target/client.js"
|
||||
:pretty-print true}}}})
|
||||
|
||||
:profiles {:dev {:cljsbuild
|
||||
{:builds {:client {:source-paths ["devsrc"]
|
||||
:compiler
|
||||
{:main devsetup
|
||||
:optimizations :none
|
||||
:source-map true
|
||||
:source-map-timestamp true}}}}}
|
||||
|
||||
:prod {:cljsbuild
|
||||
{:builds {:client {:compiler
|
||||
{:optimizations :advanced
|
||||
:elide-asserts true
|
||||
:pretty-print false}}}}}}
|
||||
|
||||
:figwheel {:repl false}
|
||||
|
||||
:cljsbuild {:builds {:client {:source-paths ["src"]
|
||||
:compiler
|
||||
{:output-dir "target/client"
|
||||
:output-to "target/client.js"}}}})
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
(enable-console-print!)
|
||||
|
||||
(def points
|
||||
(defonce points
|
||||
(r/atom
|
||||
{:p1 (g/point 100 100)
|
||||
:p2 (g/point 200 200)
|
||||
|
@ -48,6 +48,5 @@
|
|||
(.getElementById js/document id))
|
||||
|
||||
(defn ^:export run []
|
||||
(r/render-component
|
||||
[main]
|
||||
(by-id "app")))
|
||||
(r/render [main]
|
||||
(by-id "app")))
|
||||
|
|
Loading…
Reference in New Issue