Circumflex Scalate Helper: Quick Start

If you use Maven for building your project, add following lines to pom.xml (or merge XML sections accordingly):

  <cx.version><!-- desired version --></cx.version>

If you prefer SBT, make sure that libraryDependencies of your project contains following artifact:

"ru.circumflex" % "circumflex-scalate" % cxVersion % "compile->default"

where cxVersion points to desired Circumflex version. Here's the sample project configuration:

import sbt._

class MyProject(info: ProjectInfo) extends DefaultProject(info) {
  val cxVersion = "2.0"

  override def libraryDependencies = Set(
      "ru.circumflex" % "circumflex-scalate" % cxVersion % "compile->default"
  ) ++ super.libraryDependencies


You can follow SBT Setup Guide to create a new project.

Note that first-time builds usually require a substantial amount of dependencies downloads.

You should import this package if you intend to use Scalate in your web application:

import ru.circumflex.scalate._

You can also use aliased imports to prevent collisions between method names:

import ru.circumflex.{scalate => sc}    // import under alias "sc"
sc.render("/path/to/template.ssp")      // access members

Here's the example usage from Circumflex Web Application:

import ru.circumflex._, core._, web._, scalate._

class Main extends RequestRouter {
   get("/hello/:name") = render("/templates/hello.ssp")

Two methods are used for rendering: render(template: String, statusCode: Int = 200, layout: Boolean = true) and view(view: String, it: AnyRef). Consult Scalate Documentation for more details.

By default, the ServletTemplateEngine is used which resolves templates from servlet context. If you wish to use your own TemplateEngine implementation with the methods of scalate package, just set the scalate.engine configuration parameter to fully-qualified class name of templage engine implementation.