0

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.

LordotU
  • 43
  • 1
  • 1
  • 7
  • No, it placed separately. I don't need to include it to the build file. It should load dynamically by optimized modules. – LordotU Jan 30 '15 at 21:29
  • Yes. Also, in the build file and by default (in dev process) I use the same `underscore-min.js` file. – LordotU Jan 31 '15 at 08:19

0 Answers0