Answer the question
In order to leave comments, you need to log in
Is there a way to convert pug to twig?
Hello. Tell me if someone has come across the need to convert PUG to TWIG. Found
this package, PugToTwig but can't get it to work properly.
Example PUG code from link:
pug.test
ul#users
- for user in users
li.user
// comment
= user.name
| Email: #{user.email}
a(href=user.url) Home page
PugToTwig::convert(file_get_contents('test.pug'));
<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>
Answer the question
In order to leave comments, you need to log in
You wanted to get a twig template, you got it. Now is the time to feed it to the twig template engine, which will render the html from the resulting twig template.
Have you tried looking towards twig.js , so that the layout is already in the twig templates?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question