Keeping up with upstream
This port is designed so that a new NHS.UK frontend release is a small, reviewable pull request rather than a re-port.
What comes from upstream automatically
The repository pins an exact nhsuk-frontend version (currently 10.6.1). Running npm run sync copies or generates everything that is data rather than logic:
- the compiled CSS, JavaScript, fonts references and images, served from this library
- C# parameters for every component, generated from upstream's
macro-options.jsonfiles, with upstream's descriptions and deprecation warnings - SVG icon paths and the NHS logo, rendered from upstream's own templates
- upstream's example fixtures: the options for every example and the exact HTML the Nunjucks macros produce
What is hand-written
Each component's Razor markup is a line-by-line port of its Nunjucks template. This is the only part a person has to change when upstream changes a template.
How changes are caught
Every upstream example is rendered through the Razor components and compared with upstream's HTML, ignoring only differences a browser ignores, like whitespace and attribute order. This runs in CI and on this site.
When a new upstream version is released, the upgrade pull request shows:
- which component options were added, changed or deprecated, as a diff of
macro-options.json - which parameters changed, as compile errors or new properties in the generated C#
- which examples no longer match, as failing parity checks with an HTML diff
Each pull request can also get its own copy of this site through Heroku review apps, so changes can be checked visually before merging.