I have an issue with Underscore (I use an old version [1.3.3] and can't use others for this project) _.template()
function after creating optimized build.
After optimizing I have a file with all my initial modules. Underscore (like jQuery) also placed there via shim. Templates files are excluded via onBuildWrite()
function and loaded dynamically.
But there is a big problem: after optimization _.template()
doesn't work properly. It can't evaluate multiline (but singleline code evaluates fine in some cases [I can't check all of it]) JS in template files. So, for example it can't parse this template file:
<%
var subsIconsNames = {
promosite: 'programs',
photomodel: 'models',
photographer: 'photo',
stylist: 'stylist',
nailmaster: 'nailmaster',
expo: 'exhibition',
tourism: 'turism'
};
%>
<div><%= subsIconsNames [type] %></div>
"Uncaught ReferenceError: subsIconsNames is not defined"
But without optimization it works fine.
Thanks for your attention.