Search code examples
node.jsbackbone.jspug

Jade Template for Backbone usage


I have a question regarding Jade. I want to use it with Backbone and it works as to this question how-to-define-jade-template-for-using-with-backbone. But now I need to create a URL. I tried it like this:

a.more(href!="#{homeUrl}products/<%- id -%>/<%- name.toLowerCase().replace(/ /gi, '-') -%>" title!="<%- name %>")

And I get always a SyntaxError: Unexpected token ')'. So what I wanna do is: I have a Jade-variable homeUrl which I want to have at the beginning and then the id and name separated by slash to parse url. Any hints how to achieve that?


Solution

  • I use now Pug and it works like this:

    - var prodUrl = "products/\<%- id %\>/\<%- name.toLowerCase().replace(/ /gi, '-') %\>";
    a.more(href!=homeUrl+prodUrl)