Production
Import MOJ Frontend font and image assets
Learn how to use the font and image assets from MOJ Frontend and GOV.UK Frontend.Overview
You can do this you can either:
- serve the assets from the combined assets folders, which is recommended
- copy the font and image files into your application
Serve the assets from the combined assets folders – recommended
Set up your routing so requests for files in <YOUR-SITE-URL>/assets are served from both /node_modules/govuk-frontend/dist/govuk/assets and /node_modules/@ministryofjustice/frontend/moj/assets.
If you’re using express.js, request routing could be set up as follows:
router.use('/assets', [
express.static('node_modules/@ministryofjustice/frontend/moj/assets'),
express.static('node_modules/govuk-frontend/dist/govuk/assets')
])
Copy the font and image files into your application
If you decide to copy the assets instead, copy the:
/node_modules/@ministryofjustice/frontend/moj/assets/imagescontents to<YOUR-APP>/assets/images/node_modules/govuk-frontend/dist/govuk/assets/imagescontents to<YOUR-APP>/assets/images/node_modules/govuk-frontend/dist/govuk/assets/fontscontents to<YOUR-APP>/assets/fonts
You should use an automated task or your build pipeline to copy the files, so your project folder stays up to date when updates to MOJ Frontend and GOV.UK Frontend are released.