absolutejam

absolutejam

Alternate template engines

Hey,

I’ve been enjoying LiveView for an internal toy-project, but I’m looking to see if there are any alternative HTML rendering/templating engines.

I’ve found https://github.com/rstacruz/expug which would be ideal as pug is my go-to, but it hasn’t been updated in 2 years and has no LiveView support.

There is also https://github.com/slime-lang/slime but this looks like it has some outstanding major issues.

Anyone have any suggestions or ideas?

Regards.

Most Liked

eahanson

eahanson

I’ve been using slime for 2+ years and it’s great!

It takes a few minutes to get used to it, but once you do, the thought of typing all the HTML boilerplate seems barbaric :slight_smile:

Slime:

table.extra-wide
  tr
    th colspan=2 Name
    th Age

  = for user <- @users do
    tr
      td= user.first_name
      td= user.last_name
      td= user.age

There’s even an eex to slime converter to get you started.

Edit: use phoenix_slime to use Slime with Phoenix.

edjroot

edjroot

Hey, if you’re still interested in using Expug, you can take a look at my forked repos (expug, phoenix_expug).

Nothing major done so far, but I fixed this simple bug and added support for LiveView (but I’m honestly not sure if it’s the right way to do it).

I haven’t updated the docs or anything and I don’t really have many plans for it besides fixing future bugs, but I’ll gladly help if I can. Anyway, I’ve been using it for a while (admittedly for pretty simple stuff) and I’ve had no problems except for that one minor bug.

sreyansjain

sreyansjain

Just wanted to document here that Sneeze is an extremely simple and just awesome html templating library for elixir. It is just function and lists. So you can have components, slots, etc all in an extremely simple syntax (just lists and maps). Highly recommended.

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New

We're in Beta

About us Mission Statement