Instruction file imported from Nooshu/NestJS-Frontend (
.cursor/rules/reuse-nunjucks-partials.mdc). Copyright stays with the author.
Reuse Nunjucks partials and GOV.UK macros
Do not copy-paste UI markup. Compose pages from shared partials and official macros.
- Prefer GOV.UK Frontend Nunjucks macros for Design System components (buttons, inputs, error summaries, panels, etc.) — see
.cursor/rules/govuk-frontend-ui.mdc - Prefer shared Nunjucks partials / app macros under
src/views/(for examplelayout.njk,journeys/shared/,components/) over duplicating the same HTML across pages - When the same block appears on more than one page, extract a partial or macro and
{% include %}/ call it — do not maintain parallel copies - Account and feedback UI especially: reuse existing account/feedback templates, partials, and GOV.UK macros; do not reimplement those journeys’ markup per page
- New pages extend
layout.njk(or the established layout) and import shared journey chrome (navigation, pagination wrappers) rather than inlining it - If a shared partial is missing, add one in the right
views/folder and switch callers to it in the same change - Update comments and docs when introducing a new reusable partial so others know to use it