Added re-frame skeleton
Doesn't work yet!
This commit is contained in:
parent
3b90c105d4
commit
26d4889cff
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
*.log
|
24
README.md
24
README.md
|
@ -120,6 +120,30 @@ metadata and passes it to sedit, attempting to redefine the function from the re
|
|||
the basic clojure 'all data is immutable' reason. But, when you invoke (use 'namespace :reload), it
|
||||
is able to redefine all the functions, so I must be able to work out how this is done.
|
||||
|
||||
## Development Mode
|
||||
|
||||
### 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](http://localhost:3449).
|
||||
|
||||
## Production Build
|
||||
|
||||
|
||||
To compile clojurescript to javascript:
|
||||
|
||||
```
|
||||
lein clean
|
||||
lein cljsbuild once min
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2013 Simon Brooke <stillyet-github@googlemail.com>
|
||||
|
|
56
project.clj
56
project.clj
|
@ -1,8 +1,54 @@
|
|||
(defproject fedit "0.1.0-SNAPSHOT"
|
||||
:description "An attempt to reconstruct the Cambridge Lisp 'fedit' in core editor, as a precursor to attempting to reconstruct the InterLisp DEdit editor"
|
||||
:url "http://example.com/FIXME"
|
||||
:license {:name "Eclipse Public License"
|
||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||
:url "https://github.com/simon-brooke/fedit"
|
||||
:license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
|
||||
:url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
|
||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||
[jline "2.11"]]
|
||||
:clean-targets ["classes" "bin"])
|
||||
[jline "2.11"]
|
||||
[org.clojure/clojurescript "1.9.908"]
|
||||
[reagent "0.7.0"]
|
||||
[re-frame "0.10.5"]]
|
||||
|
||||
:plugins [[lein-cljsbuild "1.1.5"]]
|
||||
|
||||
:min-lein-version "2.5.3"
|
||||
|
||||
:source-paths ["src/clj"]
|
||||
|
||||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target" "classes" "bin"]
|
||||
|
||||
:figwheel {:css-dirs ["resources/public/css"]}
|
||||
|
||||
:profiles
|
||||
{:dev
|
||||
{:dependencies [[binaryage/devtools "0.9.4"]]
|
||||
|
||||
:plugins [[lein-figwheel "0.5.13"]]}}
|
||||
|
||||
:cljsbuild
|
||||
{:builds
|
||||
[{:id "dev"
|
||||
:source-paths ["src/cljs"]
|
||||
:figwheel {:on-jsload "fedit.core/mount-root"}
|
||||
:compiler {:main fedit.core
|
||||
:output-to "resources/public/js/compiled/app.js"
|
||||
:output-dir "resources/public/js/compiled/out"
|
||||
:asset-path "js/compiled/out"
|
||||
:source-map-timestamp true
|
||||
:preloads [devtools.preload]
|
||||
:external-config {:devtools/config {:features-to-install :all}}
|
||||
}}
|
||||
|
||||
{:id "min"
|
||||
:source-paths ["src/cljs"]
|
||||
:compiler {:main fedit.core
|
||||
:output-to "resources/public/js/compiled/app.js"
|
||||
:optimizations :advanced
|
||||
:closure-defines {goog.DEBUG false}
|
||||
:pretty-print false}}
|
||||
|
||||
|
||||
]}
|
||||
|
||||
|
||||
)
|
||||
|
|
13
resources/public/index.html
Normal file
13
resources/public/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="js/compiled/app.js"></script>
|
||||
<script>fedit.core.init();</script>
|
||||
</body>
|
||||
</html>
|
1
src/clj/fedit/core.clj
Normal file
1
src/clj/fedit/core.clj
Normal file
|
@ -0,0 +1 @@
|
|||
(ns fedit.core)
|
4
src/cljs/fedit/config.cljs
Normal file
4
src/cljs/fedit/config.cljs
Normal file
|
@ -0,0 +1,4 @@
|
|||
(ns fedit.config)
|
||||
|
||||
(def debug?
|
||||
^boolean goog.DEBUG)
|
22
src/cljs/fedit/core.cljs
Normal file
22
src/cljs/fedit/core.cljs
Normal file
|
@ -0,0 +1,22 @@
|
|||
(ns fedit.core
|
||||
(:require [reagent.core :as reagent]
|
||||
[re-frame.core :as re-frame]
|
||||
[fedit.events :as events]
|
||||
[fedit.views :as views]
|
||||
[fedit.config :as config]))
|
||||
|
||||
|
||||
(defn dev-setup []
|
||||
(when config/debug?
|
||||
(enable-console-print!)
|
||||
(println "dev mode")))
|
||||
|
||||
(defn mount-root []
|
||||
(re-frame/clear-subscription-cache!)
|
||||
(reagent/render [views/main-panel]
|
||||
(.getElementById js/document "app")))
|
||||
|
||||
(defn ^:export init []
|
||||
(re-frame/dispatch-sync [::events/initialize-db])
|
||||
(dev-setup)
|
||||
(mount-root))
|
4
src/cljs/fedit/db.cljs
Normal file
4
src/cljs/fedit/db.cljs
Normal file
|
@ -0,0 +1,4 @@
|
|||
(ns fedit.db)
|
||||
|
||||
(def default-db
|
||||
{:name "re-frame"})
|
8
src/cljs/fedit/events.cljs
Normal file
8
src/cljs/fedit/events.cljs
Normal file
|
@ -0,0 +1,8 @@
|
|||
(ns fedit.events
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[fedit.db :as db]))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::initialize-db
|
||||
(fn [_ _]
|
||||
db/default-db))
|
7
src/cljs/fedit/subs.cljs
Normal file
7
src/cljs/fedit/subs.cljs
Normal file
|
@ -0,0 +1,7 @@
|
|||
(ns fedit.subs
|
||||
(:require [re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::name
|
||||
(fn [db]
|
||||
(:name db)))
|
8
src/cljs/fedit/views.cljs
Normal file
8
src/cljs/fedit/views.cljs
Normal file
|
@ -0,0 +1,8 @@
|
|||
(ns fedit.views
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[fedit.subs :as subs]
|
||||
))
|
||||
|
||||
(defn main-panel []
|
||||
(let [name (re-frame/subscribe [::subs/name])]
|
||||
[:div "Hello from " @name]))
|
Loading…
Reference in a new issue