Allow importing Nunjucks macros with a namespace without mounting 'node_modules'
See original GitHub issueI’ve just moved from the beta to v1.0.0 of the Frontend and I am wondering why you moved from the @ namespace in npm?
I was setting my nunjucks path to the
@govuk-frontend
folder and then my import path would be, for example,frontend/components/error-summary/macro.njk
. I liked this as it was clear where the macro was coming from and it kind of namespaced the govuk stuff, which allowed me to use the same naming conventions, like a components folder etc (and worked the same for SASSfrontend/settings/_colours.scss
to import the govuk one and thensettings/_colours.scss
for my project one)To get around this for nunjucks I just made the include path
node_modules
so I can specifygovuk-frontend/components/...
this works fine except for my tests have now gone from ~2s to ~13s. I assume this is because of the vast amount of folders innode_modules
, so does anyone have any solutions for this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:16 (16 by maintainers)
Top GitHub Comments
Hey Graham,
Sorry for the delay, we’ve spoken about this as a team.
We want to make this easier so you don’t have to do work around in your own code, but we think doing any of these suggestions will result in a breaking change.
So we’re going to assign this to the 3.0.0 release, let us know if this is blocking you as it may be a while before we do a 3.0.0 release.
Nick
I think these:
Would be nicer like this:
Thoughts?