I'm trying to use handlebars style templating with underscore in backbone (with require.js). I have the following:
_.templateSettings.interpolate = /\{\{(.+?)\}\}/g;
In my templates I have set up a test:
<div><%= title %> | {{ title }}</div>
I get the following in the browser:
Correct title | {{ title }}
So it looks like the standard underscore template settings are working and the handlebars style ones are getting ignored:
But if I check in the console in chrome I get this (which looks to me like it should be correct)
_.templateSettings
Object {evaluate: /<%([\s\S]+?)%>/g, interpolate: /\{\{(.+?)\}\}/g, escape: /<%-([\s\S]+?)%>/g}
Any ideas why this isn't working correctly?