From 64ce50e59ebc3750fe959e42e741c55148bcaead Mon Sep 17 00:00:00 2001
From: Thomas Heller
Date: Thu, 22 Mar 2018 16:22:23 +0100
Subject: [PATCH] update example
---
.gitignore | 4 +++
README.md | 65 +++++++++++++++++-----------------------
package.json | 2 +-
shadow-cljs.edn | 8 ++---
src/starter/browser.cljs | 10 +++----
5 files changed, 39 insertions(+), 50 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6f8307d..0a7d0d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,7 @@
/target
/yarn.lock
/package-lock.json
+/.shadow-cljs
+/*.iml
+/.nrepl-port
+/.idea
diff --git a/README.md b/README.md
index e217926..966fc81 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,15 @@ This is a minimum template you can use as the basis for CLJS projects intended t
## Required Software
-- [node.js v6.0.0+](https://nodejs.org/en/download/)
-- [Java8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (Java9 has some issues, so stick with Java SE 8 for now). OpenJDK also works.
+- [node.js (v6.0.0+)](https://nodejs.org/en/download/)
+- [Java (8+)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
+
+## User Guide
+
+This repository only shows a basic example of how to get a basic Browser build.
+
+Please refer to the full [User Guide](https://shadow-cljs.github.io/docs/UsersGuide.html) for more information.
+
## Running the Example
@@ -13,28 +20,26 @@ This is a minimum template you can use as the basis for CLJS projects intended t
git clone https://github.com/shadow-cljs/quickstart-browser.git quickstart
cd quickstart
npm install
-npx shadow-cljs clj-repl
+npx shadow-cljs server
```
+This runs the `shadow-cljs` server process which all following commands will talk to. Just leave it running and open a new terminal to continue.
+
The first startup takes a bit of time since it has to download all the dependencies and do some prep work. Once this is running we can get started.
```txt
-(shadow/watch :app)
+npx shadow-cljs watch app
```
-You do not have to do this at the REPL, you can also run `npx shadow-cljs watch app` in another terminal. The result will be the same.
+This will begin the compilation of the configured `:app` build and re-compile whenever you change a file.
-Either way you should see a message like this:
+When you see a "Build completed." message your build is ready to be used.
```txt
[:app] Build completed. (23 files, 4 compiled, 0 warnings, 7.41s)
```
-When you do you can start using the integrated development server to open the page in the browser.
-
-```txt
-open http://localhost:8020
-```
+You can now then open [http://localhost:8020](http://localhost:8020).
The app is only a very basic skeleton with the most useful development tools configured.
@@ -56,13 +61,9 @@ The app is only a very basic skeleton with the most useful development tools con
{:main ;; <- becomes public/js/main.js
{:entries [starter.browser]}}
+ ;; start a development http server on http://localhost:8020
:devtools
- ;; before live-reloading any code call this function
- {:before-load starter.browser/stop
- ;; after live-reloading finishes call this function
- :after-load starter.browser/start
- ;; serve the public directory over http at port 8020
- :http-root "public"
+ {:http-root "public"
:http-port 8020}
}}}
```
@@ -73,8 +74,6 @@ It defines the `:app` build with the `:target` set to `:browser`. All output wil
`:devtools` configures some useful development things. The `http://localhost:8020` server we used earlier is controlled by the `:http-port` and serves the `:http-root` directory.
-`:before-load` and `:after-load` are useful callbacks that will be used by the devtools when live-reloading code. They are optional but they control the live-reload. If you do not need any callbacks just configure `:autoload true`.
-
The last part is the actual `index.html` that is loaded when you open `http://localhost:8020`. It loads the generated `/js/main.js` and then calls `start.browser.init` which we defined in the `src/start/browser.cljs`.
```html
@@ -91,28 +90,25 @@ The last part is the actual `index.html` that is loaded when you open `http://lo