-
Notifications
You must be signed in to change notification settings - Fork 639
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
how to 'wrap' a macro #1464
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for Nunjucks! On the GOV.UK Prototype Kit we use it extensively, and one thing we do is load in macros through a custom plugin system.
We do that in a base layout file (lets say that is called
base.njk
).I'm trying to wrap some macros from one plugin to add functionality to them (set some default values). So I want to do something like this (slightly simplified):
If I do this in the same file that myComponent is imported in, this works. However due to constraints in the plugin system I can't do it there, so I'm trying to do it in a child layout that extends
base.njk
. If I do that it stops working, it seemsmyComponent
is available as a macro to run, but can't be reassigned (it saysmyComponent
is undefined). So doing it with a new name works but isn't what I need:Is there a way to achieve 'wrapping' like this in a child layout, or method other than reassigning it in the same layout?
The text was updated successfully, but these errors were encountered: