Can I use haml template engine instead of erb?

I like a jets and trying to port my rails app to jets(not afterburner mode).
My rails application use haml template engine.
see: https://github.com/haml/haml

So, I’d like to use haml with jets.
Is there any way to use haml?

@ruzia Dug into this a little bit. There are 2 options:

  1. Use the tongueroo/haml fork that has the changes needed. Example:

Gemfile:

gem "haml", git: "https://github.com/tongueroo/haml"

Unsure if #1 will eventually be accepted and merged into the haml upstream project: https://github.com/haml/haml/pull/1009

  1. Add config/initializers/haml.rb

Here’s the initializer code:

With the 2nd approach, you can keep up with haml updates by updating the haml gem with bundler update. With the fork, changes will only be updating if the fork is updated.

Think overall, would probably go with #2. Since don’t really plan to update the fork often TBH.

1 Like

Thanks!!

I’ll try 2nd approach.

I tried a different approach and I just extracted it to a gem.

Could you test if this works for you?

2 Likes

RE: https://github.com/ceritium/haml-jets/

That’s just awesome. Cleaner code also :+1: