Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How can I escape curly braces inside jade templates?

How can I escape curly braces inside jade templates?

Problem

ho can I Escape Curly Braces inside a jade teplate? (I use jade inside node.js)

I want to render jQuery templates to the client. The part I want to escape looks like this:

div(class='clear')
script(id='BoardListTemplate', type='text/x-jQuery-tmpl')
  

${Title}

  • Add new Item
  • {{tmpl(Items) "#BoardListItemTemplate"}}
script(id='BoardListItemTemplate', type='text/x-jQuery-tmpl')
  • ${$data.Description}
    Assigned to: ${$data.AssignedTo}
    StoryPoints: ${$data.StoryPoints}
  • script(src='/javascripts/Scrummr.Engine.js', id='BoardListItemTemplate', type='text/javascript')

    many thanks

    Problem courtesy of: Juergen Gutsch

    Solution

    You have to use the pipe ( | ) sign in front of each line inside the script block.

    See https://gist.github.com/2047079 for an example.

    Solution courtesy of: Golo Roden

    Discussion

    View additional discussion.



    This post first appeared on Node.js Recipes, please read the originial post: here

    Share the post

    How can I escape curly braces inside jade templates?

    ×

    Subscribe to Node.js Recipes

    Get updates delivered right to your inbox!

    Thank you for your subscription

    ×