Gradle Dust.js Plugin

LinkedIn Dust.js is a powerful, high-performance, and extensible front-end templating engine. Here is an excellent article comparing Dust.js with other template engines.

After learning Gradle, I have been using it almost exclusively for my JVM projects. While Dust.js plugins have been written for Play Framework and JSP, but it seems that nobody had written one for Gradle to compile Dust.js templates at build time.

As a result, I wrote my own, which is available on GitHub. The plugin uses Mozilla Rhino to invoke the dustc compiler. You do not need to have Node.js or NPM installed to use the plugin.

Using the plugin is easy. First, add a buildscript dependency to pull the gradle-dustjs-plugin artifact:

buildscript {
  repositories {
  dependencies {
    classpath 'com.linkedin:gradle-dustjs-plugin:1.0.0'

Then, apply the plugin:

apply plugin: 'dustjs'

Finally, configure the plugin to specify your input files:

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

At build time, the dustjs task will compile your templates to JavaScript files. The basename of the template file is used as the current name. For example, compiling the template is equivalent to running the following dustc command:

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

Please check it out and feel free to open issues and pull requests.

Designing this Blog

I wanted the design of the blog to be minimalist and focused on the two primary types of content: text and code. I built the blog's template with Bootstrap, using @mdo's Bootstrap blog template as a starting point, and removed all the accents and chrome, save for the page footer.

This blog makes use of two different typefaces. All text content on this blog uses Donald Knuth's iconic Computer Modern Serif font, applied using @christianp's CM web fonts. All inline code is typeset in Computer Modern Typewriter.

Code listings, on the other hand, use Liberation Mono and is typeset against a subtly different background to contrast with the text discussion. I fell in love with the Base16 Ocean color scheme by Chris Kempson and have been using Base16 Ocean Dark as the color scheme for my terminal and Vim. For the code listings on this blog, I chose to use Base16 Ocean Light to complement the minimal look of the blog.

func fibonacci(n int) int {
    if n < 2 {
        return n
    return fibonacci(n - 1) + fibonacci(n - 2)

Finally, the blog is generated using Jekyll and is hosted on GitHub Pages.