addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

underscore.js templates (corrected subject line)

From: Janos M.
Sent on: Thursday, April 12, 2012 2:17 PM

 I need to embed an underscore.js template in an ERB or JSP. It uses
 the <% %> syntax which I want to preserve (anybody has to be able to
 edit the template).
 What's the best way to embed the template so I can retrieve it with
 jQuery for processing?
 Any ideas?

 One solution is to add this line in the ERB referencing the template
 file. This avoids the processing of the <% %> tags:

 <div id="template1"><­%=­me(__FILE__)+"/templ­.file") %></div>

 If I don't want to dynamically load the template (through Ajax), what
 is an other solution?



People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy