summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barri <japgolly@gmail.com>2014-06-30 09:32:21 +1000
committerDavid Barri <japgolly@gmail.com>2014-06-30 09:32:21 +1000
commit761fd9f28dd7cc9f75ade42967b45a8cb0414413 (patch)
tree993a18c7e4c652f85cd5020554e111d76562f8ba
parentb30855868910c86f07b355233a4bd60c6d45118b (diff)
downloadworkbench-761fd9f28dd7cc9f75ade42967b45a8cb0414413.tar.gz
workbench-761fd9f28dd7cc9f75ade42967b45a8cb0414413.tar.bz2
workbench-761fd9f28dd7cc9f75ade42967b45a8cb0414413.zip
Update readme.md
-rw-r--r--readme.md56
1 files changed, 39 insertions, 17 deletions
diff --git a/readme.md b/readme.md
index 4cf43ed..3bd1b8e 100644
--- a/readme.md
+++ b/readme.md
@@ -11,34 +11,56 @@ A SBT plugin for [scala-js](https://github.com/lampepfl/scala-js) projects to ma
Check out the [example app](https://github.com/lihaoyi/workbench-example-app) for a plug-and-play example of workbench in action.
-To Use
-------
-
-- Clone this from Github into a local directory
-- Add a `addSbtPlugin("com.lihaoyi" % "workbench" % "0.1.2")` to your `project/build.sbt`
-- Add `workbenchSettings` to your project settings in `build.sbt`:
+Installation
+------------
+- Add to your `project/plugins.sbt`
```scala
-import scala.js.workbench.Plugin._
+resolvers += "spray repo" at "http://repo.spray.io"
+
+resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
+addSbtPlugin("com.lihaoyi" % "workbench" % "0.1.2")
+```
+- Add to your `build.sbt`
+```scala
workbenchSettings
```
+If you're using `project/Build.scala` or similar, also add:
+```scala
+import scala.js.workbench.Plugin._
+```
+- So that workbench knows how to restart your application, specify a `bootSnippet` property in your SBT build, which is a javascript command to start your application, e.g.
+```scala
+bootSnippet := "ScalaJS.modules.example_ScalaJSExample().main();"
+```
+- For all web pages you would like to integrate with workbench, add
+```html
+<script type="text/javascript" src="/workbench.js"></script>
+```
+
+### Usage
+
+Once the above installation steps are completed, simply open your desired HTML file via `http://localhost:12345` with the URL path being any file part relative to your project root. e.g. `localhost:12345/target/scala-2.10/classes/index.html`. This should serve up the HTML file and connect it to workbench.
+
+
+# Live Reloading
-- Define your `bootSnippet`, which is a piece of javascript to be run to start your application, e.g. `bootSnippet := "ScalaJS.modules.example_ScalaJSExample().main();"`. scala-js-workbench requires this so it can use it to re-start your application later on its own.
-- Include a `<script src="/workbench.js"></script>` tag in your HTML page to connect the page to workbench.
-- Open the desired HTML file via it's `localhost` URL, e.g. `localhost:12345/target/scala-2.10/classes/index.html`. This should serve up the HTML file and connect it to workbench.
+You have a choice of what you want to do when the code compiles.
-You have a choice of what you want to do when the code compiles:
+#### refreshBrowsers
-refreshBrowsers
-===============
-`refreshBrowsers <<= refreshBrowsers.triggeredBy(packageJS in Compile)`
+```scala
+refreshBrowsers <<= refreshBrowsers.triggeredBy(packageJS in Compile)
+```
This will to make any client browsers refresh every time `packageJS` completes, saving you flipping back and forth between SBT and the browser to refresh the page after compilation is finished.
-updateBrowsers
-==============
-`updateBrowsers <<= updateBrowsers.triggeredBy(packageJS in Compile)`
+#### updateBrowsers
+
+```scala
+updateBrowsers <<= updateBrowsers.triggeredBy(packageJS in Compile)
+```
This will attempt to perform an update without refreshing the page every time `packageJS` completes, which is much faster than a full page refresh since the browser doesn't need to parse/exec the huge blob of `extdeps.js`. This involves: