Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tameemsafi/1daf7e371319ca47d77b786a457c4148 to your computer and use it in GitHub Desktop.
Save tameemsafi/1daf7e371319ca47d77b786a457c4148 to your computer and use it in GitHub Desktop.
Nunjucks - Import all macros into a global variable
{# Import macros for global use in all views #}
{% set components = {} %}
{% for component in macroFilePaths %}
{% import component as temp %}{% set macro = _.assign(components, temp) %}
{% endfor %}
{# end #}
@AdeptSEO
Copy link

AdeptSEO commented Mar 8, 2022

Hello! Can you please tell me how it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment