0

I wonder if theres a workaround to use twig combined with haml for symfony2 views.

This is Haml http://haml.info/ (This is for Ruby On Rails) Basically is to use this:

%section.container
  %h1= post.title
  %h2= post.subtitle
  .content
    = post.content

instead of this:

<section class=”container”>
  <h1><%= post.title %></h1>
  <h2><%= post.subtitle %></h2>
  <div class=”content”>
    <%= post.content %>
  </div>
</section>

This is the version for php https://code.google.com/p/phamlp/ but I wondering if I can use it in Symfony 2

Rodolfo Velasco
  • 845
  • 2
  • 12
  • 27
  • 2
    Yes it is possible. No idea what haml is or how to combine it with twig but Symfony 2 itself is very extendable. I would suggest locating the search bar on your browse, copying your question into the bar then press the search button. You might be astonished at the results. – Cerad May 08 '15 at 17:57

1 Answers1

1

Have you tried the arnaud-lb/MtHamlBundle?

According to the README, it can mix Twig and Haml templates.

Notes: The bundle seems to be locked on Symfony 2.1 and there are probably unnecessary dependencies. You could fork the repo and try to change the version in composer.json. To understand how to install forked bundle, you can watch read the answers of this Stackoverflow question. If it works, consider sending a pull request to repository.

Community
  • 1
  • 1
Thomas Potaire
  • 6,166
  • 36
  • 39