Is there any way to convert heex template to eex template?

I am working on a project in which half of my templates are with eex extension and half are with heex i want to convert heex to eex for now i tried by simply changing extension but it gives me render error.

First up, unless you have a really good reason to go from heex → eex, you are much better off going from eex → heex. You will be moving your project forward (heex is the recommended format now) rather than backwards.

heex provides checks around correctness of the html, which eex doesn’t, so it’s much better for web application templating.

Assuming you are happy to move everything to heex, I found a migration tool (I have not tried it): GitHub - Multiverse-io/eextoheex: Automatic conversion of html.eex templates to heex, and there a simple guide here to do it manually: Quick migration from LEEx to HEEx

You won’t find any resources to go from heex to eex as no-one is really doing that. If you do want to do it you simply have to reverse the steps in the manual guide.

2 Likes

these are two different languages, its not just a matter of changing the extension. Like you don’t port C++ to Elixir by replacing the extension.

2 Likes

thanks for you reply the problem im facing with heex is code editor not detecting the html it looks like plain text but eex works fine

Im trying to add custom navbar and styling which works fine for eex but not for heex

You should learn the difference between heex and eex, so You could translate in both direction…

It also works fine with heex, but You need to adapt the syntax. It’s really the same number of corrections from eex to heex, or heex to eex.

Reading the error message can help You find the part to adapt…