We were successfully experimenting rendering HTML from templates stored as strings dynamically with
phoenix_live_view version bellow
We were using the function
EEx.eval_string/3 such as:
options = [engine: Phoenix.LiveView.HTMLEngine] EEx.eval_string(my_template, [assigns: socket.assigns], options))
And it was working fine.
But now, trying to upgrade to
phoenix_live_view:0.18.18 we got an error saying:
function Phoenix.LiveView.HTMLEngine.init/1 is undefined or private
Taking a look at the git repository, in fact, the module was change and it doesn’t have the
Looking a bit into it, we found a change on
Phoenix.Component that seems to be related to this. Where it was:
options = [ engine: Phoenix.LiveView.HTMLEngine, file: __CALLER__.file, line: __CALLER__.line + 1, caller: __CALLER__, indentation: meta[:indentation] || 0, source: expr ]
It is now:
options = [ engine: Phoenix.LiveView.TagEngine, file: __CALLER__.file, line: __CALLER__.line + 1, caller: __CALLER__, indentation: meta[:indentation] || 0, source: expr, tag_handler: Phoenix.LiveView.HTMLEngine ]
We tried to change the engine to
Phoenix.LiveView.TagEngine with the
:tag_handler, but it fails because it requires a
:caller option which we don’t have as we aren’t using the function inside a macro.
Any hints of why it changed and which engine should we use?
Thanks in advance.