全局安装或者本地安装都可以。
npm install fis3-parser-translate-jst
在 fis-conf.js 中加入以下代码。
fis.match('/static/tmpl/**.jst', {
parser: fis.plugin('translate-jst'),
rExt: '.js'
}).match('/static/tmpl/**.{js, jst}', {
isMod: true,
packTo: '/static/components.js'
});
hello.jst
var hellp = 'Hello';
<div>
<% if(hello){ %>
<%=hello%>,<%=name%>
<% } %>
</div>
main.jst
var Hello = require('hello.jst');
<div>
<%=Hello({name:xu})%>
</div>