【问题标题】:Is it posible to combine inside Symfony 2.3.* twig with haml?是否可以在 Symfony 2.3.* twig 中与 haml 结合使用?
【发布时间】:2015-05-08 17:36:40
【问题描述】:

我想知道是否有一种解决方法可以将 twig 与 haml 结合用于 symfony2 视图。

这是 Haml http://haml.info/(这是用于 Ruby On Rails)基本上就是用这个:

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

而不是这个:

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

这是 php https://code.google.com/p/phamlp/ 的版本,但我想知道我是否可以在 Symfony 2 中使用它

【问题讨论】:

  • 是的,这是可能的。不知道 haml 是什么或如何将它与 twig 结合,但 Symfony 2 本身是非常可扩展的。我建议在您的浏览器中找到搜索栏,将您的问题复制到栏中,然后按搜索按钮。您可能会对结果感到惊讶。

标签: symfony twig haml


【解决方案1】:

你试过arnaud-lb/MtHamlBundle吗?

根据README,它可以混合Twig和Haml模板。

注意事项: 该捆绑包似乎被锁定在 Symfony 2.1 上,并且可能存在不必要的依赖关系。您可以分叉回购并尝试更改version in composer.json。要了解如何安装分叉包,您可以观看read the answers of this Stackoverflow question。如果可行,请考虑向存储库发送拉取请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-07
    • 2015-01-02
    • 2019-02-15
    相关资源
    最近更新 更多