Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How EEx Turns Your Template into HTML (mitchellhanberg.com)
70 points by bo0tzz on April 14, 2022 | hide | past | favorite | 7 comments



iolist are great: https://nathanmlong.com/2021/05/what-is-an-iolist/

This is how an high level language such as erlang can be very efficient at printing out strings: native language support for strings embedded in lists. That way a template engine doesn't have to allocate memory and copy every time it needs to prepend or append to strings together. Just wrap them in another list.

IO.puts([[ "this", [ "is", [ "an" ]]] | "iolist" ])


Related to this, this is old but still a great blogpost:

https://www.evanmiller.org/elixir-ram-and-the-template-of-do...


I really appreciated the comparison table between Temple, Surface, EEx, and HEEx at the end.


The usage and the steps to use EEx.Engine are really underdocumented IMO. I've tried to implement custom syntaxes for LiveView several times and ended up just copy-pasting and constructing the relevant structs manually.


Really interesting article! so does this mean you could use an eex Engine to render liquid? (https://shopify.github.io/liquid/)


You may want to take a look at solid: https://github.com/edgurgel/solid


Yes, that should be doable.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: