pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
387 stars 42 forks source link

Refactor compiler to support Twig as target language #105

Closed hason closed 6 years ago

hason commented 7 years ago

See https://github.com/arnaud-lb/MtHaml

kylekatarnls commented 7 years ago

Hi, all PugPHP is already refactoring in a new project: https://github.com/phug-php

I work on it with the TaleJade developer (https://github.com/Talesoft/tale-jade) and the twig adapter is already planned in this new version.

Thanks!

kylekatarnls commented 6 years ago

Twig output extension started: https://github.com/pug-php/twig

It already handle basic code like this:

echo PugToTwig::convert('
ul#users
  - for user in users
    li.user
      // comment
      = user.name
      | Email: #{user.email}
      a(href=user.url) Home page
');

It will output the following:

<ul id="users">
  {% for user in users %}
    <li class="user">
      {#  comment #}
      {{ user.name | e }}
      Email: {{ user.email | e }}
      <a href="{{ user.url | e }}">Home page</a>
    </li>
  {% endfor %}
</ul>
kylekatarnls commented 6 years ago

This should meet the expectations of your case: https://github.com/pug-php/twig