Intro to Play Framework

Scala Edition

James Ward ~ @_JamesWard

Create a New Play App

activator new

IDE Support

activator idea

Run the App

activator ~run

Open the App

http://localhost:9000

Testing

Specs2, ScalaTest, etc

Run All Tests Once

activator test

Run All Tests Continuously

activator ~test

Run One Test

activator "test-only my.namespace.MySpec"

Run Failed Tests

activator test-quick

Asset Pipeline via sbt-web

Unified Client/Server Development

  • Incremental
  • Parallel
  • Node native or Node JVM (Trireme)
  • Dependency management with WebJars and/or NPM
  • Any sbt project
  • sbt-autoprefixer
  • sbt-closure
  • sbt-coffeescript
  • sbt-concat
  • sbt-css-compress
  • sbt-digest
  • sbt-dustjs-linkedin
  • sbt-filter
  • sbt-gzip
  • sbt-html-minifier
  • sbt-imagemin
  • sbt-jshint
  • sbt-jst
  • sbt-less
  • sbt-mocha
  • sbt-purescript
  • sbt-rjs
  • sbt-simple-url-update
  • sbt-stylus
  • sbt-uglify

Setup

project/plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
assets/javascripts/foo.coffee
<script src='@routes.Assets.at("javascripts/foo.min.js")'></script>
Specify Dependencies in build.sbt
"org.webjars" % "jquery" % "2.1.1"
Use a WebJar
<script src='@routes.Assets.at("lib/jquery/jquery.min.js)'></script>

Reactive Requests