mfr*_*tas 5 javascript node.js underscore.js gruntjs
我正在尝试生成一个JSP页面,因为JSP使用的模板分隔符与下划线使用的模板分隔符相同.
看文档 - > https://github.com/gruntjs/grunt/wiki/grunt.template#wiki-grunt-template-setDelimiters我可以看到他们有一个功能
grunt.template.addDelimiters(name, opener, closer)
Run Code Online (Sandbox Code Playgroud)
两个问题:
grunt.template.process()(我有多个,而对于其他非.jsp模板,默认分隔符很好)?任何帮助表示赞赏.谢谢.
来自grunt.template.process的文档:
默认模板分隔符为<%%>,但如果options.delimiters设置为自定义分隔符名称,则将使用这些模板分隔符.
这基本上意味着您可以使用之前添加的分隔符的名称调用grunt.template.process.
例如,如果您想在一个应该完成工作的处理步骤中使用方括号作为分隔符:
// first add the new delimiters which you want to use
grunt.template.addDelimiters('square-brackets', '[', ']');
// and use it
grunt.template.process(template, {delimiters: 'square-brackets'});
// and use it with the default delimiters (named 'config')
grunt.template.process(template);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |