Qqwy

Qqwy

TypeCheck Core Team

Hi there! The recent developments w.r.t. Surface and HEEx are very cool!

One thing that would be the cherry on top, would be an indentation-based templating language that compiles down to one of these. If you no longer need to write closing tags, HTML (and any similar XML-like languages) can be expressed much more concisely (without any loss of expressivity).

As an example, you might look at Haml which is a Ruby-based variant (emitting ERb – Embedded Ruby files) of such a language. In Elixir there does exist Calliope which is an Haml parser. Unfortunately, Calliope has been abandoned since 2015.


I would love to write or collaborate on a templating engine like this.
However, where to start? What would be the most appropriate way to create a templating engine that builds on top of HEEx/LEEx/EEx(/Surface)?

I guess the question can be split up as:

  • How to create a templating engine which can be recognized both from a sigil and from a new file extension?
  • How to wrap (H/L)EEx inside another templating engine?

Showing Posts 1 to 10

joaoevangelista

joaoevangelista

You might want to check out Slime, also with support for phoenix e and liveview, they have pretty advanced in terms of support, maybe is a good go to for contributions or inspiration

TwistingTwists

TwistingTwists

zimt28

zimt28

You could try Temple which allows you to write your templates in Elixir.

Qqwy

Qqwy OP

TypeCheck Core Team

Thank you very much for your responses!

Slime fits perfect for my use-case. Very nice to see that such a mature library already exists.
I will use it, and focus contributions there if needed.

silverdr

silverdr

I was also happy to find it some time ago and also opted for using it (it’s really hard PITA to get back once you got used to haml/slime) in a non-trivial project. Alas, it seems to become abandonware just like all other (?) After kludging around for last two versions of Phoenix, I feel like the need to waste time again and again is no longer worth it. Unless somebody knows a current, maintained fork or another maintained option I’ll end up rewriting lots of slime templates back into [h]eex :frowning:

Any other suggestions?

UPDATE: found a fork working with phx 1.7

https://github.com/populimited/phoenix_slime

jamieorc

jamieorc

Replying here because I’m not allowed yet to create a topic in the Phoenix Forum (dunno why–new here).

I’m using Slim(e) for views as I work through the Phoenix on Rails tutorial. I’ve come to the section on using core component functions and I can not figure out the correct syntax for a component like link which has an inner_block. I’ve searched the web, the docs, looked at the source code for link, but no love so far.

Any help appreciated!

LostKobrakai

LostKobrakai

Nobody can post to top level categories. They’re only there to aggregate topics of their subcategories.

hubertlepicki

hubertlepicki

I don’t know if that works at all. The new Phoenix 1.7 is using HEEX template language and I suspect this may not be working with either LiveView or Phoenix.Components that use ~H sigil.

I was very happily using Slime too but with the LiveView/HEEX changes now being the default, and also with the formatter that formats HEEX and editors having good support for the syntax, I decided to stop using it. Much people did the same I think.

jamieorc

jamieorc

OK. Thanks!

smathy

smathy

Yep, I did precisely the same for the same reasons. I do still miss the elegance of auto-closing tags :frowning:

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

abreujp
New article: Elixir Project Structure — From mix new to a Growing Codebase I’ve published a new article in my Elixir learning series on d...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews