Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
plugin supports server-side compilation of .dust template files to their .js counterparts
JavaScript Groovy
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


dust JS Resource plugin

This plugin is designed to optimize the use of .dust js files. The processing will compile specified .dust files into their .js counterparts, and place the javascript into the processing chain to be available to the other resource plugin features. The plugin uses the Resources plugin and plays nicely with both the zipped and cached resources plugins. It will also include the core of the dust library which is required to render dust templates on the client.


Add the plugin to your BuildConfig.groovy file.

plugins {
    runtime: 'dustjs-resources:0.9.3'


Declaring Resources

Users can explicitly define which version of dust they would like to use. The default is the latest version (uses dust-core-2.1.0 and dust-helpers-1.1.1)

modules = {
    profile {
      dependsOn 'dustjs'
      resource url: 'dust/profile/guest.dust', attrs: [rel: "javascript/dust", type: 'js'], bundle: 'bundle_profile'

To explicitly define a particular version of the plugin use the following format:

 modules = {
      profile {
        dependsOn 'dustjs111'
        resource url: 'dust/profile/guest.dust', attrs: [rel: "javascript/dust", type: 'js'], bundle: 'bundle_profile'


  • dependsOn: dustjs or a particular version dustjs111.
  • url: location of the dust template file.
  • attrs[rel]: should be set to javascript/dust for compatibility reasons.
  • attrs[type]: must be js.
  • bundle: must be set as will not default correctly. To add to default bundle use bundle_<module name>.

Template Names

Template names are based on the resource URL. If the URL is templates/foo.dust, then the template name will be templates/foo. Note that the .dust extension is removed.

The default path separator is /. If you want to change it, you can specify a value for templatesPathSeparator in the configuration. For example, adding

grails.resources.mappers.dustjs.templatesPathSeparator = '_'

will change the template name to templates_foo.

If you specify a value for templatesRoot in the configuration, then that value will be stripped from the template name. For example, adding

grails.resources.mappers.dustjs.templatesRoot = 'templates'

will change the template name to just foo.


All configuration variables should be relative to:

  • templatesRoot: The root folder of the templates relative to web-app. This value will be stripped from template paths when calculating the template name. Default is none.
  • templatesPathSeparator: The delimiter to use for template names. Default is /

Special Thanks



  • Added templatesPathSeparator and templatesRoot configs


  • Attempt to add dust version 1.1.1, but forgot to add the dust-helpers.js file. The helpers are now part of this project and no longer in the main dustjs project


  • Corrected the 0.9.1 issue. Provided backwards compatibility to allow users to explicitly define which version of dustjs they would like to use


  • Added latest dust-core-2.1.0 and dust-helpers-1.1.1
  • Use latest Resources plugin with version 1.2.1
Something went wrong with that request. Please try again.