我有container.twig包括component.twig并传递一个名为'mock'的对象.
在container.twig中:
{% set mock = {
title : "This is my title"
}
%}
{% include 'component.twig' with mock %}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我想将模拟数据移动到自己的文件.这不起作用:
Container.twig
{% include 'component.twig' with 'mock.twig' %}
Run Code Online (Sandbox Code Playgroud)
在mock.twig中
{% set mock = {
title : "This is my title"
}
%}
Run Code Online (Sandbox Code Playgroud)
我使用gulp-twig但它在大多数方面像标准树枝一样工作.https://github.com/zimmen/gulp-twig