https://github.com/andreaferretti/scalajs-demo
A tutorial for a simple scala-js application
https://github.com/andreaferretti/scalajs-demo
Last synced: 7 months ago
JSON representation
A tutorial for a simple scala-js application
- Host: GitHub
- URL: https://github.com/andreaferretti/scalajs-demo
- Owner: andreaferretti
- Created: 2015-03-25T17:29:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-25T17:48:26.000Z (over 10 years ago)
- Last Synced: 2025-01-29T22:31:41.223Z (8 months ago)
- Language: Scala
- Size: 148 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Example application written in Scala.js and React
=================================================This is a barebone example of an application written in
[Scala.js](http://www.scala-js.org/).Get started
-----------To get started, open `sbt` in this example project, and execute the task
`fastOptJS`. This creates the file `target/scala-2.11/demo-fastopt.js`.The file `index-dev.html` contains the working application. It uses
the scalajs-react router, which in turn relies on the history API of
the browser. Since this API is disabled for security reasons on local
files, you need to serve the main directory through a server.For instance, you can run
python -m SimpleHTTPServer
and then visit `http://localhost:8000/index-dev.html`.
During development, it is useful to use `~fastOptJS` in sbt, so that each
time you save a source file, a compilation of the project is triggered.
Hence only a refresh of your Web page is needed to see the effects of your
changes.Run the tests
-------------To run the test suite, execute the task `test`. If you have installed
[Node.js](http://nodejs.org/), you can also run `fastOptStage::test` which is
faster.The fully optimized version
---------------------------For ultimate code size reduction, use `fullOptJS`. This will take several
seconds to execute, so typically you only use this for the final, production
version of your application. While `index-dev.html` refers to the
JavaScript emitted by `fastOptJS`, `index.html` refers to the optimized
JavaScript emitted by `fullOptJS`.