### Start Development Server Source: https://github.com/govuk-one-login/service-header/blob/main/docs/dev-contribution-notes.md Starts a basic server and recompiles the dist folder when files in src are updated. ```bash npm run dev ``` -------------------------------- ### Install Service Header Plugin Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Run this command in your terminal to install the service header plugin for the Prototype Kit. ```bash npm install @govuk-one-login/service-header ``` -------------------------------- ### Install Gitlint Source: https://github.com/govuk-one-login/service-header/blob/main/docs/dev-contribution-notes.md Install Gitlint using pip or brew. This tool is used to lint git commit messages. ```bash pip install gitlint # or `brew install gitlint` if using the brew package manager ``` -------------------------------- ### Use Service Header and Service Navigation Components Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Example demonstrating how to use both the `govukOneLoginServiceHeader` and `govukServiceNavigation` macros in a Nunjucks template. ```njk {% block govukHeader %} {{ govukOneLoginServiceHeader({ signOutLink: "/test-signout", oneLoginLink: "/test-one-login", lng: "cy" }) }} {{ govukServiceNavigation({ serviceName: "Service name", serviceUrl: "#", navigation: [ { href: "#", text: "Navigation item 1" }, { href: "#", text: "Navigation item 2", active: true }, { href: "#", text: "Navigation item 3" } ] }) }} {% endblock %} ``` -------------------------------- ### Install Service Header via NPM Source: https://github.com/govuk-one-login/service-header/blob/main/README.md Install the GOV.UK One Login service header package using NPM. This is the recommended method for services using Nunjucks. ```sh npm install @govuk-one-login/service-header ``` ```sh npm install @govuk-one-login/service-header@6.0.0 ``` -------------------------------- ### Uninstall and Install Service Header Package Source: https://github.com/govuk-one-login/service-header/blob/main/docs/v5-upgrade-notes.md Use these npm commands to uninstall the old package and install the new one when upgrading to v5.0.0. ```sh npm uninstall govuk-one-login-service-header npm install @govuk-one-login/service-header ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md If you encounter 'xcrun: error: invalid active developer path' on a Mac, run this command before installing the npm package. ```bash xcode-select --install ``` -------------------------------- ### Use Service Header Component Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Example of how to use the imported `govukOneLoginServiceHeader` macro in a Nunjucks template, with custom link destinations and language. ```njk {% block govukHeader %} {{ govukOneLoginServiceHeader({ signOutLink: "/test-signout", oneLoginLink: "/test-one-login", homepageLink: "/your-prototype-homepage", lng: "cy" }) }} {% endblock %} ``` -------------------------------- ### Build All Project Files Source: https://github.com/govuk-one-login/service-header/blob/main/docs/dev-contribution-notes.md Use this npm script to copy and compile project files from the src folder into the dist folder. ```bash npm run build-all ``` -------------------------------- ### Version Management Source: https://github.com/govuk-one-login/service-header/blob/main/docs/dev-contribution-notes.md Increment the project version using npm. Choose major, minor, or patch based on the changes. ```bash npm version major | minor | patch ``` -------------------------------- ### Overwrite Homepage Link in Template Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Use this Nunjucks set statement within a template to change the destination of the GOV.UK link in the header. ```njk {% set homepageLink = "https://example.service.gov.uk/" %} ``` -------------------------------- ### Import Service Header Component Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Import the service header Nunjucks component into your existing layouts or templates. ```njk {% from "service-header/service-header.njk" import govukOneLoginServiceHeader %} ``` -------------------------------- ### Current Nunjucks Macros for Service Header and Navigation Source: https://github.com/govuk-one-login/service-header/blob/main/README.md As of service header 6.0.0, the service header and service navigation are decoupled. Use these separate Nunjucks macros. Ensure 'serviceName' is specified. ```nunjucks {% govukOneLoginServiceHeader({ signOutLink: "/placeholder" }) %} {% govukServiceNavigation({ serviceName: "Service name", serviceUrl: "#", navigation: [ { href: "#", text: "Navigation item 1" }, { href: "#", text: "Navigation item 2", active: true }, { href: "#", text: "Navigation item 3" }] }) %} ``` -------------------------------- ### Watch Sass Files Source: https://github.com/govuk-one-login/service-header/blob/main/docs/dev-contribution-notes.md A self-explanatory script to watch for changes in Sass files. ```bash npm run watch-sass ``` -------------------------------- ### Overwrite One Login Link in Template Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Use this Nunjucks set statement within a template to change the destination of the One Login link in the header. ```njk {% set oneLoginLink = "https://example.service.gov.uk/" %} ``` -------------------------------- ### Set Header Language to Welsh Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Use this Nunjucks set statement within a template to change the header language to Welsh. ```njk {% set lng = "cy" %} ``` -------------------------------- ### Overwrite Sign Out Link in Template Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Use this Nunjucks set statement within a template to change the destination of the sign out link in the header. ```njk {% set signOutLink = "https://example.service.gov.uk/sign-out" %} ``` -------------------------------- ### Update Service Header Plugin Source: https://github.com/govuk-one-login/service-header/blob/main/docs/prototype-kit-installation.md Run this command in your terminal to update the service header plugin to the most recent version. ```bash npm update @govuk-one-login/service-header ``` -------------------------------- ### Update Nunjucks Import Path Source: https://github.com/govuk-one-login/service-header/blob/main/docs/v5-upgrade-notes.md Update the import path in your Nunjucks templates to reflect the package rename in v5.0.0. ```html {% from "di-govuk-one-login-service-header/service-header.njk" import govukOneLoginServiceHeader %} ``` ```html {% from "service-header/service-header.njk" import govukOneLoginServiceHeader %} ``` -------------------------------- ### Deprecated Nunjucks Macro for Service Header Source: https://github.com/govuk-one-login/service-header/blob/main/README.md This Nunjucks macro was used before service header version 6.0.0 for integrating the service navigation into the header. It is now deprecated. ```nunjucks {% govukOneLoginServiceHeader({ signOutLink: "/placeholder", serviceNavigationParams: { navigation: navigation, serviceName: serviceName, navigationLabel: "Test" }}) %} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.