Skip to content
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

Using macros throws Uncaught TypeError: $ctor$$3_template$$3$$ is not a constructor #103

Open
sinasalek opened this issue Sep 27, 2016 · 2 comments

Comments

@sinasalek
Copy link

Here is how is use macros:
Note that panel/test.twig.js is included in the page as well. i'm guessing that there is something with how i use it. any suggestion ?

{% macro test(a1) %}
    {% include 'panel/test.twig' %}
{% endmacro %}
{% import _self as macros %}
{{ macros.test(a1)}}
@sinasalek
Copy link
Author

Also when i remove {% import _self as macros %}, it no longer throws error but the macro also won't work and is ignored by compiler

@sinasalek
Copy link
Author

sinasalek commented Sep 27, 2016

{% import _self as macros %} cause twigjs to generate context["macros"] = this.env_.createTemplate(this); so it seems that using macros in the same template is not supported yet. I move the macro to a different template and imported it to work around it.
Also it seems that generally including a template inside a macro also does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant