Skip to content

Commit

Permalink
feat(prototype kit integration): users of prototype-kit-v13 should ha…
Browse files Browse the repository at this point in the history
…ve macros and filters available (#378)

In version 13 of GOV.UK Prototype Kit we have some new integration points.  This makes use of the
new integration points and makes the installation simpler for users.  Specifically, for
moj-frontend, this will import all the nunjucks macros (components) and filters without the user
having to do any setup themselves.
  • Loading branch information
nataliecarey committed Sep 30, 2022
1 parent 72220a4 commit 89cbf0a
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 4 deletions.
89 changes: 85 additions & 4 deletions package/govuk-prototype-kit.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,87 @@
{
"nunjucksPaths": ["/"],
"scripts": ["/moj/all.js"],
"assets": ["/moj/assets"],
"sass": ["/moj/all.scss"]
"nunjucksFilters": [
"/moj/filters/prototype-kit-13-filters.js"
],
"scripts": [
"/moj/all.js"
],
"assets": [
"/moj/assets"
],
"sass": [
"/moj/all.scss"
],
"nunjucksPaths": [
"/"
],
"nunjucksMacros": [
{
"importFrom": "moj/components/side-navigation/macro.njk",
"macroName": "mojSideNavigation"
},
{
"importFrom": "moj/components/organisation-switcher/macro.njk",
"macroName": "mojOrganisationSwitcher"
},
{
"importFrom": "moj/components/primary-navigation/macro.njk",
"macroName": "mojPrimaryNavigation"
},
{
"importFrom": "moj/components/identity-bar/macro.njk",
"macroName": "mojIdentityBar"
},
{
"importFrom": "moj/components/sub-navigation/macro.njk",
"macroName": "mojSubNavigation"
},
{
"importFrom": "moj/components/notification-badge/macro.njk",
"macroName": "mojNotificationBadge"
},
{
"importFrom": "moj/components/ticket-panel/macro.njk",
"macroName": "mojTicketPanel"
},
{
"importFrom": "moj/components/timeline/macro.njk",
"macroName": "mojTimeline"
},
{
"importFrom": "moj/components/badge/macro.njk",
"macroName": "mojBadge"
},
{
"importFrom": "moj/components/messages/macro.njk",
"macroName": "mojMessages"
},
{
"importFrom": "moj/components/banner/macro.njk",
"macroName": "mojBanner"
},
{
"importFrom": "moj/components/pagination/macro.njk",
"macroName": "mojPagination"
},
{
"importFrom": "moj/components/filter/macro.njk",
"macroName": "mojFilter"
},
{
"importFrom": "moj/components/button-menu/macro.njk",
"macroName": "mojButtonMenu"
},
{
"importFrom": "moj/components/page-header-actions/macro.njk",
"macroName": "mojPageHeaderActions"
},
{
"importFrom": "moj/components/search/macro.njk",
"macroName": "mojSearch"
},
{
"importFrom": "moj/components/header/macro.njk",
"macroName": "mojHeader"
}
]
}
8 changes: 8 additions & 0 deletions src/moj/filters/prototype-kit-13-filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { addFilter } = require('govuk-prototype-kit').views
const getAllFilters = require('./all')

const allFilters = getAllFilters()

Object.keys(allFilters).forEach(name => {
addFilter(name, allFilters[name])
})

0 comments on commit 89cbf0a

Please sign in to comment.