Gradle Dust.js Plugin

A Gradle plugin for compiling Dust.js files.

License

License

Categories

Categories

JavaScript Languages Gradle Build Tools
GroupId

GroupId

com.linkedin
ArtifactId

ArtifactId

gradle-dustjs-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Gradle Dust.js Plugin
A Gradle plugin for compiling Dust.js files.
Project URL

Project URL

https://github.com/davidzchen/gradle-dustjs-plugin
Source Code Management

Source Code Management

https://github.com/davidzchen/gradle-dustjs-plugin

Download gradle-dustjs-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.linkedin/gradle-dustjs-plugin/ -->
<dependency>
    <groupId>com.linkedin</groupId>
    <artifactId>gradle-dustjs-plugin</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.linkedin/gradle-dustjs-plugin/
implementation 'com.linkedin:gradle-dustjs-plugin:1.0.0'
// https://jarcasting.com/artifacts/com.linkedin/gradle-dustjs-plugin/
implementation ("com.linkedin:gradle-dustjs-plugin:1.0.0")
'com.linkedin:gradle-dustjs-plugin:jar:1.0.0'
<dependency org="com.linkedin" name="gradle-dustjs-plugin" rev="1.0.0">
  <artifact name="gradle-dustjs-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.linkedin', module='gradle-dustjs-plugin', version='1.0.0')
)
libraryDependencies += "com.linkedin" % "gradle-dustjs-plugin" % "1.0.0"
[com.linkedin/gradle-dustjs-plugin "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.mozilla : rhino jar 1.7R4

test (1)

Group / Artifact Type Version
org.spockframework : spock-core jar 0.6-groovy-1.8

Project Modules

There are no modules declared in this project.

Gradle Dust.js Plugin Build Status

A Gradle plugin that compiles templates. This plugin requires LinkedIn Dust.js and uses Rhino to run the Dust compiler.

Usage

Add the plugin

Add a buildscript dependency on the plugin to pull the artifact for the plugin:

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'com.linkedin:gradle-dustjs-plugin:1.0.0'
  }
}

Apply the plugin

apply plugin: 'dustjs'

Configure the Plugin

dustjs {
  source = fileTree('src/main/tl') {
    include 'template.tl'
  }
  dest = 'src/main/webapp/assets/js'
}

Tasks

This plugin adds the dustjs task and the implicit cleanDustjs task.

dustjs

The dustjs task compiles the specified Dust .tl files from the source directory into .js files into the dest directory.

The basename of the template file is used as the template name. For example, if one of the files to be compiled is template.tl, then running the plugin is equivalent to the following dustc invocation:

$ dustc --name=template source/template.tl dest/template.js

cleanDustjs

The cleanDustjs task completely deletes the dest directory.

Acknowledgements

This plugin makes use of code adapted from Oliver Becker's Gradle LESS plugin and Jonathan Parsons' Play Framework Dust.js plugin.

Versions

Version
1.0.0