Edit file project/Build.scala
libraryDependencies ++= Seq(
"jp.furyu" %% "play-velocity-plugin" % "LATEST_VERSION"
)
Edit file conf/play.plugins
5000:jp.furyu.play.velocity.VelocityPlugin
object YourController extends Controller {
def index = Action {
Ok(VM("vm/index.vm", Map("name" -> "__name__", "title" -> "__title__")))
}
}
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
</head>
<body>
$name
</body>
</html>
Plugin load velocity.properties
in velocity.jar
.
If customize its settings, add file velocity_plugin.properties
and edit any settings.
runtime.introspector.uberspect = jp.furyu.play.velocity.ScalaUberspect
A sample application is available, to run it:
- clone the repository
- sbt or sbt.bat
- In sbt console, enter
project scala-sample
andrun
- open a browser to localhost:9000