@ministryofjustice/hmpps-connect-dps-shared-items
v3.7.4
Published
A package to share Connect DPS functionality across applications
Maintainers
Keywords
Readme
hmpps-connect-dps-shared-items
A library for sharing DPS Components across applications.
Contents
Using the library
Installation
To install the package, run the following command:
npm install @ministryofjustice/hmpps-connect-dps-shared-itemsNunjucks macro usage
Add the hmpps-connect-dps-shared-items assets directory to nunjucks configuration in your application:
const njkEnv = nunjucks.configure(
[
path.join(__dirname, '../../server/views'),
...,
'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/',
],
{
autoescape: true,
express: app,
},
)then import the component into your nunjucks file:
{% from "dps/components/alert-flag/macro.njk" import alertFlag %}Styling
Include the package scss within the index.scss file. You can either import all:
@import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/scss/all';or import the specific component scss you are using, e.g:
@import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/dps/components/alert-flag/alert-flag';Client side javascript
In your client side javascript, include:
import * as connectDps from '@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/js/all'
connectDps.initAll()