Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation doesn't explain how to import Nunjucks filters #523

Open
gregtyler opened this issue Oct 23, 2023 · 0 comments
Open

Documentation doesn't explain how to import Nunjucks filters #523

gregtyler opened this issue Oct 23, 2023 · 0 comments
Labels
docs Change to documentation good first issue Good for newcomers

Comments

@gregtyler
Copy link
Contributor

The Messages and Timeline components both depend on a mojDate filter, which is provided in the Pattern Library code. However, the documentation doesn't contain instructions on how to install that filter, or even mention that this is necessary.

We should add a documentation page explaining how to install filters, including a snippet to start with, and link to it from the two components that use the filter in a banner in the "How to use" section.

An existing snippet in a README is:

let mojFilters = require('./node_modules/@ministryofjustice/frontend/filters/all')();
mojFilters = Object.assign(mojFilters);
Object.keys(mojFilters).forEach(function (filterName) {
  nunjucksAppEnv.addFilter(filterName, mojFilters[filterName])
});

But I dare say we can clean that up a bit before publication.

This only affects production Node apps, as prototypes auto-configure filters.

@gregtyler gregtyler added good first issue Good for newcomers docs Change to documentation labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Change to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant