An Underscore.js template loader for webpack that works with strict mode by prefixing all variables referenced in the templates with a data object. It allows you to use existing templates without having to manually go through them and prefix each referenc
npm install underscore-template-strict-loaderunderscore-template-strict-loader
=========================



An Underscore.js template loader for Webpack that works with strict mode. Underscore templates don't work with strict mode by default because they use the with(data) function to give you access to your data variables. This plugin works by prefixing each variable in your templates with data.whatever so {{ name }} becomes {{ data.name }}.
bash
npm install underscore-template-strict-loader
`
$3
underscore-template-strict-loader is MIT licenced.
$3
`js
module.exports = {
module: {
test: /\.jst/,
loader: 'underscore-template-strict-loader',
query: {
templateSettings: {
evaluate: /\{\[([\s\S]+?)\]\}/,
escape: /\{\{([\s\S]+?)\}\}/,
interpolate: /\{\!([\s\S]+?)\!\}/
},
// use dataObjName option to define the name of the data object
// for templates. It's "data" by default.
dataObjName: 'templateData',
// use the globals option to define variables that
// should not be prefixed
globals: ['$', 'jQuery'],
// Add this only if you want to prefix the template with
// an HTML comment with the path to the file for debugging.
addFilenameComment: true
}
}
};
``