
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
underscore-template-strict-loader
Advanced tools
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
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 }}.
Once you have the Underscore package installed, you can run:
npm install underscore-template-strict-loader
underscore-template-strict-loader is MIT licenced.
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
}
}
};
This is being used in Beta at SpyFu
FAQs
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
The npm package underscore-template-strict-loader receives a total of 141 weekly downloads. As such, underscore-template-strict-loader popularity was classified as not popular.
We found that underscore-template-strict-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.