Backbone 用途的 Jade 模板
Jade Template for Backbone usage
我有一个关于 Jade 的问题。我想将它与 Backbone 一起使用,它适用于这个问题 how-to-define-jade-template-for-using-with-backbone。但是现在我需要创建一个 URL。我这样试过:
a.more(href!="#{homeUrl}products/<%- id -%>/<%- name.toLowerCase().replace(/ /gi, '-') -%>" title!="<%- name %>")
而且我总是收到 SyntaxError: Unexpected token ')'。所以我想做的是:我有一个 Jade 变量 homeUrl,我想在开头使用它,然后用斜杠分隔的 id 和名称来解析 url。任何提示如何实现这一目标?
我现在用 Pug,它是这样工作的:
- var prodUrl = "products/\<%- id %\>/\<%- name.toLowerCase().replace(/ /gi, '-') %\>";
a.more(href!=homeUrl+prodUrl)
我有一个关于 Jade 的问题。我想将它与 Backbone 一起使用,它适用于这个问题 how-to-define-jade-template-for-using-with-backbone。但是现在我需要创建一个 URL。我这样试过:
a.more(href!="#{homeUrl}products/<%- id -%>/<%- name.toLowerCase().replace(/ /gi, '-') -%>" title!="<%- name %>")
而且我总是收到 SyntaxError: Unexpected token ')'。所以我想做的是:我有一个 Jade 变量 homeUrl,我想在开头使用它,然后用斜杠分隔的 id 和名称来解析 url。任何提示如何实现这一目标?
我现在用 Pug,它是这样工作的:
- var prodUrl = "products/\<%- id %\>/\<%- name.toLowerCase().replace(/ /gi, '-') %\>";
a.more(href!=homeUrl+prodUrl)