"Could not convert mjml file" error using mjml-theme-converter for Prestashop

374 Views Asked by At

I´m developing an email template theme for Prestashop using Mjml and Twig and now I need to convert the mjml.twig templates into html.twig templates:

welcome.mjml.twig -------- welcome.html.twig
account.mjml.twig --------- account.html.twig
order_conf.mjml.twig ----- order_conf.html.twig
template.mjml.twig--------- template.html.twig

For this the Prestashop team has created a tool that does exactly that (https://github.com/PrestaShop/mjml-theme-converter), but I´m getting "Could not convert mjml file" error once I run the following command:

$ ./bin/console prestashop:mail:convert-mjml simple_mjml ./simple_mjml

The errors are on the MjmlConverter.php (line 122), and once traced it seems to come from the Symfony TemplateNameParser.php (line 75)

https://github.com/PrestaShop/mjml-theme-converter/blob/master/src/AppBundle/Mjml/MjmlConverter.php https://github.com/symfony/symfony/blob/3.4/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

Usuario@PC-DANIEL MINGW64 /v/WEB/PRESTASHOP/EMAIL/DESARROLLO/mjml-theme-converter (master)
$ ./bin/console prestashop:mail:convert-mjml simple_mjml ./simple_mjml -vvv
Converting template account.mjml.twig
08:17:21 INFO      [php] User Deprecated: Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.
[
  "exception" => ErrorException {
    #message: "User Deprecated: Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0."
    #code: 0
    #file: "V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser.php"
    #line: 75
    #severity: E_USER_DEPRECATED
    trace: {
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser.php:75 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser.php:53 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader.php:82 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\twig\twig\src\Loader\FilesystemLoader.php:150 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\twig\twig\src\Environment.php:299 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\twig\twig\src\Environment.php:381 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php:131 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php:50 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\src\AppBundle\Converter\TwigTemplateConverter.php:310 {
        › \r
        › $renderedLayout = $this->engine->render($conversionTemplatePath);\r
        › //Transform back {{ }} statements\r
      }
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\src\AppBundle\Converter\TwigTemplateConverter.php:189 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\src\AppBundle\Converter\TwigTemplateConverter.php:161 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\src\AppBundle\Command\ConvertMJMLThemeCommand.php:105 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:255 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:1010 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:86 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:255 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:74 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:148 { …}
      V:\WEB\PRESTASHOP\EMAIL\DESARROLLO\mjml-theme-converter\bin\console:27 { …}
    }
  }
]

In MjmlConverter.php line 122:

  [AppBundle\Mjml\MjmlException]  
  Could not convert mjml file     


0

There are 0 best solutions below