Skip to main content

https://designnotes.blog.gov.uk/2016/01/18/weve-updated-the-prototype-kit/

We’ve updated the prototype kit

Posted by: , Posted on: - Categories: Likely to change

The GOV.UK prototype kit is the tool we use for rapidly creating HTML prototypes for GOV.UK services.

Today we released version 2.0.0 of the kit

It’s got numerous improvements over version 1, but most significantly we’ve switched the templating language - from Mustache to Nunjucks.

From Mustache to Nunjucks.
Franco Nero in Enter The Ninja (1981)

Why we stopped using Mustache

Mustache has dwindling support and isn’t powerful enough to do some of the things that users of the kit need to do. Nunjucks is backed by Mozilla and is powerful and extensible. You can check out some of the features here.

Perhaps the most immediately useful feature is the ability to pass data into includes (called macros in Nunjucks). For example, you could create a macro for doing sets of radio buttons. The macro would handle all the repetitive HTML, you’d just supply the labels.

From Mustache to Nunjucks
Comparison of a typical Mustache include versus equivalent Nunjucks macro for a set of 3 radio buttons

We’ll include some example macros in a future release, once we have a better idea of what people would find useful. But for now we’d like everyone to have a play and share their work.

Upgrading your existing prototypes

If you want to upgrade your existing prototypes to use the latest version of the kit you'll need to convert your pages to use Nunjucks. It's pretty easy and we've included step by step instructions in the guide to upgrading your prototypes.

Thanks everyone

Loads of people have helped us get to v2.0.0, both inside and outside GDS. Extra special thanks go to Gemma Leigh, Joe Lanman, Ed Horsford and Rebecca Cottrell.

Sharing and comments

Share this page

4 comments

  1. Comment by Zac Tolley posted on

    Well done, and is it my or does the Nunjucks look a lot like Twig?

    • Replies to Zac Tolley>

      Comment by Tim Paul posted on

      Thanks and yes, Nunjucks is similar to Twig, Swig and Jinja.

  2. Comment by Andrew Charlton posted on

    Thanks for pointers (via Slack) migrated our existing version tot he new one over a couple of sessions. Beyond the different syntax and a couple of errors I made it all seems to have gone fine.

    • Replies to Andrew Charlton>

      Comment by Tim Paul posted on

      That's good to know Andrew. I've migrated a few myself and it's not usually a problem.