Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Jan 27, 2014
1 parent 717dfd5 commit 1a8784b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -25,7 +25,7 @@ This application will work in Firefox, Safari, Chrome and Opera. It will not wor

More information on **[matthiasnehlsen.com](http://matthiasnehlsen.com/blog/2013/06/23/angularjs-and-play-framework/)**.

**Edit January 2014**: there is also a client version running Scala.js, please check the **[README](./scala-js/README.md)** in the scala-js folder.
**Edit January 2014**: there is also a client version running Scala.js, please check the **[README](./scala-js/README.md)** in the scala-js folder for more information how to build this. The Closure Compiler optimized JavaScript of the application is included in this project, whereas the other resulting files from the build process are excluded for reasons of space.

## Licence

Expand Down
35 changes: 20 additions & 15 deletions scala-js/README.md
Expand Up @@ -5,30 +5,35 @@ This is an initial attempt at rewriting the sse-chat client with

## Get started

To get started, open `sbt` in this example project, and issue the task
`packageJS`. This creates the file `target/scala-2.10/example.js` and its
siblings `example-extdeps.js` and `example-intdeps.js`.

After making changes, you will need to run `copy.sh` to make the resulting
There are two important sbt tasks you need in the development process:

1) `sbt packageJS` will package your application including the entire Scala
standard library translated into JavaScript. This creates the file
`target/scala-2.10/example.js` and its siblings `example-extdeps.js` and
`example-intdeps.js`This task is fast as it only needs
to compile the project source code and nothing else. However this really only works
during development on your local machine because the browser will need to download
almost 20 MB for this.

2) `sbt optimizeJS` run the Google Closure Compiler over your application, resulting
in a file that is compact enough for production usage. For example this application
is 300 KB after this step and compresses down to about 60 KB. This step is slow, so you
probably don't want to run this every single time something changes.

After running each of these steps, you will need to run `copy.sh` to make the resulting
file available to the Play project using this client.

During development, it is useful to use `~packageJS` in sbt, so that each
time you save a source file, a compilation of the project is triggered.
You will need to run `copy.sh`again after each recompilation (or you manage
to have sbt handle the copying, in which case I would like to ask you share
by submitting a pull request).
by submitting a pull request). You can also use `~optimizeJS` to have the task listen
for changes. However, note that this will get your fans spinning and drain your battery
fast if you make plenty of changes.

The non-optimized version will be available under this address:
**[localhost:9000/react-scalajs](http://localhost:9000/react-scalajs)**
when running play locally by executing `play run` in the parent directory.

## The optimized version

Instead of running `packageJS`, you can also run `optimizeJS` to have the
**[Google Closure Compiler](https://developers.google.com/closure/compiler/**
generate a much more compact version of the JavaScript code. You can also use
`~optimizeJS` to have the task listen for changes. However, note that this will
get your laptop warm and eat your battery fast if you make plenty of changes.

Here you can find the opmtized version:
Here you can find the optimized version:
**[localhost:9000/react-scalajs-opt](http://localhost:9000/react-scalajs-opt)**

0 comments on commit 1a8784b

Please sign in to comment.