Skip to content

A somewhat advanced project template for Scala.js with jQuery.

Notifications You must be signed in to change notification settings

Aurora12/scalajs-project-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala.js Project Template

A somewhat advanced template for a Scala.js project with DOM and jQuery.

The project is in no way a minimal one, as it aims to showcase everything one would probably end up doing in a real-world app.

The project doesn't contain any UI components framework.

  • Shows mapping code in both directions: Scala.js code accessing JavaScript code and vice versa.
  • Shows using libraries from WebJars and from external JavaScript files.
  • Shows passing parameters to build and generating resources from templates.
  • Shows using utility Scala code in SBT build task.
  • Includes coursier, wartremover and scalafmt.

Usage

Build target folder is bin in project root. That's where all of the resources are copied to and where the fastOptJs/fullOptJS output is directed.

The version parameter is optional, it defaults to the version setting in build.sbt.

Clean and build from command line

/build-dev.sh -Dversion="0.1.0"

or

/build-release.sh -Dversion="0.1.0"

Open /bin/index.html to see the result.

Clean and build from SBT's interactive mode

Start SBT with sbt -mem 2000 -Dversion="0.1.0". The memory setting here prevents SBT from crashing with out of memory exception after a dozen rebuilds in interactive mode.

  • Use release or dev commands to clean, build and collect resources.
  • Use buildRelease or buildDev to build and collect resources.
  • Use fastOptJS or fullOptJS as you normally would with any Scala.js project to just build main javascript files.

Project structure

  • /bin – this is where all build files go. The directory is created by build commands and is deleted completely by clean command.
  • /project – a standard SBT project directory, which contains BuildUtils.scala, that does file manipulation during build.
  • /resources – contains static resources (like css and images) and templates (html) that get processed by build logic.
  • /src/main/resources/ – the standard directory for js libraries. See js/example.js there.

About

A somewhat advanced project template for Scala.js with jQuery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published