-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello,
I've been making a cli script for convert Pug to Twig template.
This is my code
<?php
include 'vendor/autoload.php';
if( empty($argv[1]) ) exit('Missing file parameter.');
$file = $argv[1];
$filename = basename($file, ".pug");
$path = dirname($file);
$ouputfile = $path . DIRECTORY_SEPARATOR . $filename . ".htm";
#var_dump($filename, $path, $ouputfile);
$content = PugToTwig::convert(file_get_contents($file));
#var_dump($content);
if ( !empty($content) ) file_put_contents($ouputfile, $content);
exit();
But I cannot keep format for output file.
<ul id="users">{% for user in users %}{% endfor %}<li class="user">{# comment #}{{ user.name | e }}Email: {{ user.email | e }}<a href="{{ user.url | e }}">Home page</a><span>aky</span></li></ul>
Can you help me to keep format syntax for twig output file ?
Thanks a lot
Neo
Metadata
Metadata
Assignees
Labels
No labels