/sbt-dustjs

dust.js pre-compiler for SBT 0.11+

Primary LanguageJavaScript

SBT dust.js

This plugin is a pre-compiler for the client-side templating system dust.js. The plugin builds your dust templates into javascript files that you can then include into your markup pages. For those who arn't familiar, dust.js recently achieved fame on the linkedin engineering blog

If you have a lot of templates, then you might want to considering merging them into a single file as an optimisation, but that is out of the scope of this plugin which is currently only concerned with template compilation.

Usage

Add the following to your project/plugins.sbt file:


resolvers += Resolver.url("sbt-plugin-releases", 
  new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/")
    )(Resolver.ivyStylePatterns)

addSbtPlugin("eu.getintheloop" % "sbt-dustjs" % "0.0.3")

Then stuff this line onto the end of your build.sbt:

seq(dustSettings: _*)

With the plugin added, you just need to place your dust templates in src/main/dust and then invoke dust from the SBT 11.x shell. Likewise, any call to compile should also trigger altered dust templates to be recompiled.

If you want to publish the dust templates to somewhere other than the default managed resource file location, do something like this in your build.sbt file:


(resourceManaged in (Compile, DustKeys.dust)) <<= (sourceDirectory in Compile){
    _ / "resources" / "www" / "js" / "templates"
}