Sharing Macros between Modules?

Actually it seems possible now. If you have a design you want to reuse, you can make it a macro that you import to other modules.

Example macro.html:

{% macro bar(heading, subheading) %}
<h1>{{ heading }}</h1><p>{{ subheading }}</p>
{% endmacro %}

Example module.html:

{% import "Custom/macros.html" as foo %}

<div>
some content goes here
{{ foo.bar(module.heading, module.subheading) }}
</div>

--------------------------

If you want to avoid passing countless parameters to the macro, you can also do it like this:

Example macro.html:

{% macro bar(obj) %}
<h1>{{ obj.heading }}</h1><p>{{ obj.subheading }}</p>
{% endmacro %}

Example module.html:

{% import "Custom/macros.html" as foo %}

<div>
some content goes here
{{ foo.bar(module.heading_and_subheading) }}
</div>

‘heading_and_subheading’ would be a group in the module that contains ‘heading’ and ‘subheading’. You pass that group directly to the macro.

You’d just need to enforce standards in naming accross the different modules that use that macro.

Note I tested this with Email modules, not page modules.