Created
January 30, 2018 11:27
-
-
Save tameemsafi/1daf7e371319ca47d77b786a457c4148 to your computer and use it in GitHub Desktop.
Nunjucks - Import all macros into a global variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# 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 #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! Can you please tell me how it works?