-
Notifications
You must be signed in to change notification settings - Fork 237
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
Support user defined global functions #2005
Conversation
Personally I would not want to call this file 'globals' as it is only for the view, not routes, and it's specifically for functions, not other data types. So I'd suggest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will discuss naming of globals
with @nataliecarey
768dab4
to
9c83b66
Compare
I've caught up with @joelanman about this. We've had on-and-off discussions about how to support globals (variables/constants that are available everywhere, not just nunjucks) and he's raised a concern that this change might limit our options further down the line. Please can we do the following in this PR:
This means that we're providing the same behaviour to our users but leaving room to deal with something like |
3428afa
to
aa9abad
Compare
prototype-starter/app/globals.js
Outdated
@@ -0,0 +1,2 @@ | |||
const govukPrototypeKit = require('govuk-prototype-kit') | |||
const addGlobal = govukPrototypeKit.views.addFunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be putting a globals starter in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
8ddf8cf
to
1d2b1a1
Compare
Done |
|
Change has been made as requested and approved by someone else
See Feature suggestion: support user-provided functions as well as filters