Scala.js A Scala to JavaScript compiler
Scala.js compiles Scala code to JavaScript, allowing you to write your Web application entirely in Scala!
Important notice! Scala.js is still experimental! Although this is a project of LAMP/EPFL for which we will continue to provide best-effort improvements and bug fixes, it is not supported by Typesafe, and not part of any of their support contracts. You have been warned!
Noteworthy features:
- Support all of Scala (including macros!), modulo a few semantic differences
- Very good interoperability with JavaScript code. For example, use jQuery and HTML5 from your Scala.js code, either in a typed or untyped way. Or create Scala.js objects and call their methods from JavaScript.
- Integrated with sbt (including support for dependency management and incremental compilation)
- Can be used with your favorite IDE for Scala
- Generates Source Maps for a smooth debugging experience (step through your Scala code from within your browser supporting source maps)
- Integrates Google Closure Compiler for producing minimal code for production.
Get started
The easiest way to get started is to fork the bootstrapping skeleton and follow the instructions in its readme. You can also try it out in the browser.
Resources
- Documentation
- Official mailing list
- Scala.js tag on Stackoverflow. Please help building it up by asking questions.
Presentations:
- Live Coding Scala.js at SF Scala 2014 by Li Haoyi
- Live-coding with Scala.js at Scala eXchange 2013
- Presentation of Scala.js at Scala Days 2013 (older and somewhat obsolete)
Useful links
Libraries
- Static types for the DOM API, by Li Haoyi
- Static types for jQuery, brought to you by Sébastien Doeraene
- Scalatags, a HTML templating library/DSL that works on both Scala-JVM and Scala-JS, by Li Haoyi
- Scala.Rx, a change-propagation/FRP library that runs on both Scala-JVM and Scala-JS, by Li Haoyi
- uTest, a tiny, portable unit testing library that lets you run the same tests on both Scala-JVM and Scala-JS, by Li Haoyi
- Scala.js Pickling, a cross-compiling pickling (aka serialization) library for Scala.js and Scala with a common JSON-based format, by Sébastien Doeraene
Skeletons
- Play! application with Scala.js
- Node.js module with Scala.js, by Rocky Madden
Tools
- Scala.js workbench, an sbt plugin for Scala.js projects for live-reloading in the browser (example app), by Li Haoyi
- Scala.js Resource, an sbt plugin for bundling of binary files so they can be accessed from the browser, by Li Haoyi
Miscellaneous
- Port of the Dart benchmark harness by Jonas Fonseca
Contribute
Want to contribute to Scala.js? Check out the list of contributing opportunities.
Built with Scala.js
Beginning a list of websites using Scala.js:
- February 2014
- TodoMVC, an implementation of the TodoMVC example application using Scala.js, Scalatags, Scala.Rx and scala-js-dom, by Li Haoyi
- Sierpinski Triangle and Dodge the dot (Scala.js workbench example apps), by Li Haoyi
- Scala.jsFiddle, an online scratchpad that lets you compile and run Scala.js snippets right in the browser, by Li Haoyi
- December 2013
- Roll, a 2D Physics Platformer by Li Haoyi
- December 2013
- October 2013
- Several games by Li Haoyi
- July 2013
- Knapsack on a graph by Krishnan Raman
- June 2013
- April 2013
- The Reversi example by Sébastien Doeraene