twirl-api


License

License

GroupId

GroupId

com.typesafe.play
ArtifactId

ArtifactId

twirl-api_2.10
Last Version

Last Version

1.5.1
Release Date

Release Date

Type

Type

jar
Description

Description

twirl-api
twirl-api
Project URL

Project URL

https://github.com/playframework/twirl
Project Organization

Project Organization

com.typesafe.play
Source Code Management

Source Code Management

https://github.com/playframework/twirl

Download twirl-api_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/com.typesafe.play/twirl-api_2.10/ -->
<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>twirl-api_2.10</artifactId>
    <version>1.5.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.typesafe.play/twirl-api_2.10/
implementation 'com.typesafe.play:twirl-api_2.10:1.5.1'
// https://jarcasting.com/artifacts/com.typesafe.play/twirl-api_2.10/
implementation ("com.typesafe.play:twirl-api_2.10:1.5.1")
'com.typesafe.play:twirl-api_2.10:jar:1.5.1'
<dependency org="com.typesafe.play" name="twirl-api_2.10" rev="1.5.1">
  <artifact name="twirl-api_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.typesafe.play', module='twirl-api_2.10', version='1.5.1')
)
libraryDependencies += "com.typesafe.play" % "twirl-api_2.10" % "1.5.1"
[com.typesafe.play/twirl-api_2.10 "1.5.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.7

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.10 jar 3.0.8

Project Modules

There are no modules declared in this project.

Twirl Latest version Build Status

Twirl is the Play template engine.

Twirl is automatically available in Play projects and can also be used stand-alone without any dependency on Play.

See the Play documentation for the template engine for more information about the template syntax.

sbt-twirl

Twirl can also be used outside of Play. An sbt plugin is provided for easy integration with Scala or Java projects.

sbt-twirl requires sbt 1.3.0 or higher.

To add the sbt plugin to your project add the sbt plugin dependency in project/plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "LATEST_VERSION")

Replacing the LATEST_VERSION with the latest version published, which should be Latest version. And enable the plugin on projects using:

someProject.enablePlugins(SbtTwirl)

If you only have a single project and are using a build.sbt file, create a root project and enable the twirl plugin like this:

lazy val root = (project in file(".")).enablePlugins(SbtTwirl)

Template files

Twirl template files are expected to be placed under src/main/twirl or src/test/twirl, similar to scala or java sources. The source locations for template files can be configured.

Template files must be named {name}.scala.{ext} where ext can be html, js, xml, or txt.

The Twirl template compiler is automatically added as a source generator for both the main/compile and test configurations. When you run compile or test:compile the Twirl compiler will generate Scala source files from the templates and then these Scala sources will be compiled along with the rest of your project.

Additional imports

To add additional imports for the Scala code in template files, use the templateImports key. For example:

TwirlKeys.templateImports += "org.example._"

Source directories

To configure the source directories where template files will be found, use the sourceDirectories in compileTemplates key. For example, to have template sources alongside Scala or Java source files:

sourceDirectories in (Compile, TwirlKeys.compileTemplates) := (unmanagedSourceDirectories in Compile).value

Credits

The name twirl was thought up by the Spray team and refers to the magic @ character in the template language, which is sometimes called "twirl".

The first stand-alone version of Twirl was created by the Spray team.

An optimized version of the Twirl parser was contributed by the Scala IDE team.

com.typesafe.play

Play Framework

Versions

Version
1.5.1
1.5.0
1.5.0-M5
1.5.0-M4
1.5.0-M3
1.5.0-M2
1.5.0-M1
1.4.2
1.4.1
1.4.1-M1
1.4.0
1.4.0-RC4
1.4.0-RC2
1.4.0-RC1
1.4.0-M2
1.3.16
1.3.15
1.3.14
1.3.13
1.3.12
1.3.10
1.3.8
1.3.7
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-RC3
1.0.0-RC2
1.0.0-RC1
1.0-M3