使用 mjml-theme-converter for Prestashop 时出现“无法转换 mjml 文件”错误

问题描述

我正在使用 Mjml 和 Twig 为 Prestashop 开发电子邮件模板主题,现在我需要将 mjml.twig 模板转换为 html .twig 模板:

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

为此,Prestashop 团队创建了一个完全可以执行此操作的工具 (https://github.com/PrestaShop/mjml-theme-converter),但是一旦我运行以下命令,我就会收到“无法转换 mjml 文件错误:

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

错误位于 MjmlConverter.PHP(第 122 行),一旦被追踪,它似乎来自 Symfony TemplateNameParser.PHP(第 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     


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...