dust.js pre-compiler for SBT 0.11+
JavaScript Scala
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 4 commits ahead of timperrett:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


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.


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/")

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"