As the number of projects that we’re working on began increasing, we realised that we needed a better way of managing dependencies and style consistency.
Introducing the MOJ template
The result has been that our frontend development team has created a MOJ Template to help manage this across multiple languages and platforms. The template is a Ruby on Rails engine that compiles and packages a layout with accompanying assets into various different syntaxes. This allows us to manage any global changes to the layout in just one place and then publish a new version of the template in various different formats.
We currently support the following formats:
- A Ruby Gem for Ruby on Rails projects hosted on Rubygems
- A Python Package for Django projects hosted on PyPi
- A Play Framework template
- A Mustache template
- A Mustache Inheritance template
For instructions on using any of these formats, please view the readme in the GitHub repository.
Working with the GOV.UK template
Behind the MOJ Template is the GOV.UK Template. Supported by GDS, it is structured in a very similar way and manages the look of the basic GOV.UK header and footer. This dependency enables us to easily filter any major updates to the basic layout into all of our services using the MOJ template.
We have also linked the MoJ template to our instance of Jenkins CI. This allows us to run our tests on any new pull requests created in GitHub to ensure that the proposed changes don’t break anything. Once a pull request is accepted and merged into the master branch another job is run in Jenkins to automatically release a new version to RubyGems and PyPi.
We tag each revision using Semantic Versioning so that projects with a dependency on the hosted packages can continue by using a specific version number.