Skip to content

xored/scala-js-react-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Play Framework with scala-js-react

This project provides a starting point for your scala-js-react application.

Project is based on play-with-scalajs-example which is a simple example application showing how you can integrate a Play project with a Scala.js project.

The application contains three directories:

  • scalajvm Play application (server side)
  • scalajs Scala.js application (client side)
  • scala scala code that you want to share between scalajs and scalajvm (both client and server sides)

Run the application

$ sbt
> run
$ open http://localhost:9000

Features

  • Run your application like a regular Play app
    • compile simply triggers the Scala.js compilation
    • run triggers the Scala.js compilation on page refresh
    • ~compile, ~run, continuous compilation is also available
    • start, stage and dist generate the optimised javascript
    • the optimised javascript file is selected when the application runs in prod mode (start, stage, dist)
  • Source maps
    • Open your browser dev tool to set breakpoints or to see the guilty line of code when an exception is thrown
    • Source maps is disabled in production to prevent your users from seeing the source files. But it can easily be enabled in production too if needed
    • Two routes and a SourceMaps controller handle sending the Scala files to the browser. It's the Scala.js plugin that handles generating Source Maps

IDE integration

Eclipse

  1. $ sbt eclipse
  2. Inside Eclipse, File/Import/General/Existing project..., choose the root folder to import the projects

IntelliJ

  1. $ sbt gen-idea
  2. Inside IntelliJ, File/Open..., choose the root folder to import all the projects (do not use Import Project... or Import Module...)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%