Workbench is small SBT plugin making development of Scala.js applications much more pleasing experience. All you need to do is to add the plugin to your project.
- Starts local web server on
http://localhost:12345
when you enter the SBT console so you can access your HTML pages (or any other files). - Whenever you update your project files (e.g. change some of the Scala.js code), connected web browser will be automatically refreshed to reflect the changes.
- All compile output from SBT console is sent to browser console, so you can see compilation status without leaving the browser window.
-
Add the SBT plugin to
project/plugins.sbt
addSbtPlugin("com.norcane" % "workbench" % "0.1.0")
-
Enable the SBT plugin in
build.sbt
enablePlugins(WorkbenchPlugin)
Now you can start the SBT console and run the following command:
sbt ~fastOptJS
Now you can open any HTML file via http://localhost:12345
where path to the file is relative to the project root. For example if you have your HTML file located at src/main/resources/index.html
, then it will be available on http://localhost:12345/target/scala-2.12/classes/index.html
.
From now whenever you change any of your project file (HTML, CSS, Scala.js, etc.), Workbench will make sure that your browser will be refreshed to reflect all the changes properly. You can also see all SBT compilation output in the browser console, so there's no need to switch back and forth between browser and SBT console.
Workbench doesn't need any additiona configuration to work, which makes it extra easy to just drop it into your project and use it. But if you need to, here is the list of options you can use to change the default behaviour:
In case that your network connection is slow, you can enable compression of the transferred data using:
workbenchCompression := true
Below is the list of current project maintainers. Feel free to contact us in case of any troubles.
- Václav Švejcar - @vaclavsvejcar
Workbench is based on Li Haoyi's original workbench project. Big thanks to him & all the project contributors. Also be sure to check his other awesome projects such as Scalatags or Ammonite.