如何解决使用 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 举报,一经查实,本站将立刻删除。