TwirlSourceSet

API Documentation:TwirlSourceSet

Note: This class is deprecated and will be removed in the next major version of Gradle.

Note: This class is incubating and may change in a future version of Gradle.

Represents a source set containing twirl templates

apply plugin: 'play'

model {
  components {
    play {
      sources {
        withType(TwirlSourceSet) {
          // Use template format views.formats.csv.CsvFormat for all files named *.scala.csv
          // Additionally, include views.formats.csv._ package imports in generated sources.
          addUserTemplateFormat("csv", "views.formats.csv.CsvFormat", "views.formats.csv._")
          // Add these additional imports to all generated Scala code from Twirl templates
          additionalImports = [ 'my.pkg._', 'my.pkg.MyClass' ]
        }
      }
    }
  }
}

Properties

PropertyDescription
additionalImports
Incubating

The list of additional imports to add to the generated Scala code.

defaultImports
Incubating

The default imports that should be added to generated source files

source
Incubating

The source files.

userTemplateFormats
Incubating

The custom template formats configured for this source set.

Methods

MethodDescription
addUserTemplateFormat(extension, templateType, imports)
Incubating

Adds a custom template format.

Script blocks

No script blocks

Property details

List<String> additionalImports

Note: This property is incubating and may change in a future version of Gradle.

The list of additional imports to add to the generated Scala code.

TwirlImports defaultImports

Note: This property is incubating and may change in a future version of Gradle.

The default imports that should be added to generated source files

SourceDirectorySet source (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The source files.

List<TwirlTemplateFormat> userTemplateFormats

Note: This property is incubating and may change in a future version of Gradle.

The custom template formats configured for this source set.

Method details

void addUserTemplateFormat(String extension, String templateType, String... imports)

Note: This method is incubating and may change in a future version of Gradle.

Adds a custom template format.