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.
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.
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.
4 comments
Comment by Zac Tolley posted on
Well done, and is it my or does the Nunjucks look a lot like Twig?
Comment by Tim Paul posted on
Thanks and yes, Nunjucks is similar to Twig, Swig and Jinja.
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.
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.