-
Notifications
You must be signed in to change notification settings - Fork 38
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
Compilation omits non-rendering code in extends #39
Comments
I would like to look into this. To start here is the repository that reproduces the issue https://github.com/danielcaldas/issue-non-rendering-code-in-extends |
In discussion with @jamesb3ll we tought of two possible solutions for this issue. foo.html.twig_template.render = function (_context) {
text(_context.foo != null && _context.foo !== '' ? _context.foo : "Ciao");
}; bar.html.twig_template.render = function (_context) {
let foo;
foo = "hello";
_parent.render.call(_template, _context); // render parent foo.html.twig
}; Solution 1
Solution 2Since render is executed with the Do you think these are valid approaches? Can you think of a better one for this? I would like to hear your opinion @pago |
Problem with Solution 2, how will |
We don't use The original bug report is also about Melody dropping |
Ok we agree that solution 1 is more appropriate considering the things that @pago added regarding Regarding the drop of |
Sorry for the confusion. Let me clarify: Given the template above:
Melody will currently emit something like what you provided:
Problem 1 is not passing the new value of Fixing one without the other will only result in more issues. :) |
@danielcaldas I can't remember but I think we didn't address this yet, right? |
Hey @pago no I didn't finalize it, there is some work in progress here https://github.com/danielcaldas/melody/tree/fix/omitted-code-twig-extends, but it's been a while. |
Explain the problem
When using template inheritance, Melody will omit anything except for top-level variable assignments (using
{% set .... %}
) that is not contained within a block.Expected Behaviour
Melody should include all code that is non-rendering in its compilation.
Actual Behaviour
Melody only compiled top-level variable assignments.
Steps to reproduce
bar.html.twig
foo.html.twig
Rendering
bar.html.twig
withbar
set totrue
should emithello!!
but will instead emitCiao!!
.Provide a repository that reproduces issue if possible
Provide your Environment details
any
any
any
The text was updated successfully, but these errors were encountered: