有什么方法可以将速度模板与 backbone.js 集成?

Is there any method to integrate velocity template with backbone.js?

我有一个由 java 编写的网站。模板是velocity,通过java代码渲染。现在我想通过 backbone.js 编写一些代码,但是当我使用 backbone 时,模板 (underscore.js) 与速度语法不兼容。

如何在 backbone.js 中使用速度模板?

如果当前插值器有问题(不确定这是不是一个词,但我的意思是 <%%>)在下划线中,您可以按照文档中的说明更改这些( http://underscorejs.org/#template)

If ERB-style delimiters aren't your cup of tea, you can change Underscore's template settings to use different symbols to set off interpolated code. Define an interpolate regex to match expressions that should be interpolated verbatim, an escape regex to match expressions that should be inserted after being HTML-escaped, and an evaluate regex to match expressions that should be evaluated without insertion into the resulting string. You may define or omit any combination of the three. For example, to perform Mustache.js-style templating:

_.templateSettings = {
  interpolate: /\{\{(.+?)\}\}/g
};

var template = _.template("Hello {{ name }}!");
template({name: "Mustache"});
=> "Hello Mustache!"

如果不是这个,我的问题是错误的,那么我会删除这个答案