【发布时间】:2014-07-16 18:02:05
【问题描述】:
我有一个名为templates.soy 的模板,我希望能够从单独的文件中调用模板(希望不时以编程方式覆盖该文件)。我可以在同一个文件中调用模板。目前我有:
templates.soy
>{namespace plugin.example}
/**
* Template for the build
*/
{template .anthill}
<html>
<head>
...
<body>
<h2>My Form</h2>
<br />
{call .form /} //This works
{call random.me.moreFields /} //This throws an error "Attempting to render undefined template 'random.me.moreFields'
</body>
</html>
{/template}
/**
* Form info
*/
{template .form}
//custom html form stuff
{/template}
selectField.soy
>{namespace random.me}
/**
* Testing more soy files
*/
{template .moreFields}
//custom html stuff
{/template}
这可能吗?
【问题讨论】:
-
是的,你可以。但是,我有点惊讶您想以编程方式生成大豆模板。 Soy 本身就是一种元语言,编译成 JavaScript 或 java。
标签: google-closure google-closure-templates