Closed pepe closed 4 years ago
So the solution I have found is to (use mendoza/template)
and then change the value to of the :template
key to (from-file "menu.html")
as can be seen in this commit https://github.com/pepe/mendtest/commit/1f916746f87d30e73941d68d2a601db066c3c629.
It works but is not very elegant :-) and I am not sure where to put the check and the fix into the Mendoza code
I think the documentation needs to be updated here and we should use the current functionality, which is that render
expects only template functions. I think it is best for rendering to not mix module loading as well, which is why the change was made in the first place.
However, it would be nice to provide a macro or function for the above shorthand, maybe something like
{{ (template-include "main.html") }}
That would be the same as
{{ {:template (require "main.html")} }}
or something similar.
It makes sense. Should I try to come with the solution? And fix the documentation?
Thank you for the explanation.
In the documentation on page https://bakpakin.github.io/mendoza/templating.html, you mention you can include other template by just adding struct with the
:template
key and path to template as string value. But when I try it with{{ {:template "menu.html"} }}
I receive error:And indeed in the render function, it is expecting the value to be template function. What am I doing wrong?
I am using my templates under the
/templates
subfolder. Here is the reproduction repository: https://github.com/pepe/mendtest