Crown-Commercial-Service / digitalmarketplace-govuk-frontend

Where Digital Marketplace frontend components and GOV.UK Frontend live together in harmony
MIT License
7 stars 5 forks source link
digitalmarketplace portfolio

Digital Marketplace GOV.UK Frontend · JavaScript Style Guide Known Vulnerabilities

This repository provides a central repository for custom components used in the Digital Marketplace

The problem we are trying to solve:

Dependencies

Digital Marketplace GOV.UK Frontend

Digital Marketplace GOV.UK Frontend contains the code you need to start building a user interface for Digital Marketplace.

Contact the Digital Marketplace team

Digital Marketplace GOV.UK Frontend is maintained by a team at Government Digital Service. If you want to know more about Digital Marketplace GOV.UK Frontend, please email the Digital Marketplace team.

Quick start

1. Install with npm (recommended)

We recommend installing GOV.UK Frontend and Digital Marketplace GOV.UK Frontend using node package manager (npm).

npm install govuk-frontend digitalmarketplace-govuk-frontend

Digital Marketplace GOV.UK Frontend has GOV.UK Frontend as a peerDependency so you do not need to install GOV.UK Frontend with npm, however it is recommended.

2. Add GOV.UK Frontend to your Sass load paths

Digital Marketplace GOV.UK Frontend relies on GOV.UK Frontend being available to Sass.

If you're using Node Sass you can add GOV.UK Frontend to your Sass load paths using

{
  includePaths: ['node_modules/digitalmarketplace-govuk-frontend']
}

3. Load templates from GOV.UK Frontend

If you are using v2 of GOV.UK Frontend, you'll need to ensure the node_modules/govuk-frontend directory is loaded into your templating environment with a govuk prefix so that Digital Marketplace components can target the correct GOV.UK Frontend components.

With v3, targetting the node_modules/govuk-frontend directory is sufficient, as there is already a govuk subfolder.

Getting updates

To be notified when there’s a new release:

Find out how to update with npm.

Developing new components

We use gulp to automate various tasks. Below we will detail what each part of the process is and what task are run

1. Installing the repo

After cloning this repository you will need to run npm install. After npm has successfully installed all packages and dependencies, an npm postinstall script will automatically run to do the following tasks:

The reason for copying govuk-frontend to src/govuk is to ensure that govuk/ is available for templates in testing and development environments.

2. Developing components/features and previewing

Run npm run dev

3. Testing features in apps

Follow the steps in docs/publishing-a-pre-release.md to push a branch to GitHub as a release that can be consumed by other NodeJS apps.

Alternatively, you can create a package locally using npm run build:

# in digitalmarketplace-govuk-frontend
$ npm run build
# change to an app
$ cd ../digitalmarketplace-user-frontend
$ npm install ../digitalmarketplace-govuk-frontend/package

3. Publishing

Follow the steps in docs/publishing.md.

Using govuk-frontend v2

Release series 2.x.x of digitalmarketplace-govuk-frontend supports govuk-frontend v2.

If you need to backport changes to the 2.x.x series follow the steps in docs/backporting.md.

Licence

Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.

The documentation is © Crown copyright and available under the terms of the Open Government 3.0 licence.