Skip to content

scala-steward/Binding.scala-template

 
 

All-in-One Scala.js Static Web Project Template

Open in Gitpod Scala CI

This repository is a template of the basic structure for a Scala.js web project, contains all the best technologies in Scala.js community until 2023:

Note that the default branch of this repository is written in Scala 3. Check out the scala-2.13 branch for a project template in Scala 2.13.

Other libraries and tools can be found in sbt settings.

This template contains settings for a static web project, and you can additionally configure Play or Akka HTTP dependencies in web/build.sbt to turn it into a dynamic web project.

Directory Structure

  • web/

    The sbt-web project for web assets

    • build.sbt

      Sbt settings for the sbt-web project, which contains WebJars dependency configurations, including SASS / SCSS dependencies and static resources from external libraries.

    • src/main/assets/

      The root directory of static assets sources.

      • index.html

        The main page in release mode, which references uglified CSS and JS resources.

      • devMod.html

        The main page in development mode, which references indented CSS and JS resources.

      • style.scss

        The style sheet used by main page in SCSS syntax, which will be compiled to style.css by a sbt-web pipeline.

    • target/web/public/main/

      The root directory of static assets output.

      • lib/

        The output directory for Webjars dependencies.

  • js/

    The Scala.js project to create JS output used in the sbt-web project.

    • build.sbt

      Sbt settings for the Scala.js project, which contains Scala.js settings, NPM dependencies and type definitions.

    • src/main/scala/

      The directory contains Scala.js source files.

  • project/

    • plugins.sbt

      Sbt plugins dependencies.

Requirements

How to use this template?

Just clone this repository, and the following sbt tasks are available.

Build

Run the following command:

sbt assets

Then visit web/target/web/public/main/devMod.html to browse the main page.

Release mode build

By default, the assets command builds Scala.js in development mode. To build this project in release mode

sbt "set scalaJSStage := FullOptStage" assets

Then visit web/target/web/public/main/index.html to browse the main page in release mode.

Test

Run the following command:

sbt test

Then the examples in Scaladoc comments will be ran by ScalaTest.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 85.7%
  • HTML 9.0%
  • SCSS 5.3%