
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
dotjs-loader
Advanced tools
doT.js module loader for webpack
Install using npm.
doT is a peer dependency and should be installed separately:
npm install --save-dev dot dotjs-loader
Configure the loader in webpack.config.js:
module: {
loaders: [{ test: /\.dot$/, loader: 'dotjs-loader' }];
}
... and then load templates using require():
const template = require('./template.dot');
// => compiles template.dot content as template function
console.log(template());
Or, using ES6 modules:
import template from './template.dot';
// template function is the default export
console.log(template());
Pass any template data to the function:
template({ key: 'value' });
Alternatively you can explicitly call the loader without having configured it:
const template = require('dotjs-loader!./file.dot');
The following options
are available.
They map directly to doT.templateSettings
unless stated otherwise:
evaluateinterpolateencodeusedefineconditionaliteratevarnamestripappendOptions are most conveniently passed in webpack.config.js:
module: {
loaders: [
{
test: /\.dot$/,
loader: 'dotjs-loader',
options: {
varname: 'context',
},
},
];
}
dot-loader is another loader
for doT templates, but it doesn't allow configuration of templateSettings.
At the time of writing there was a
PR to add this feature,
but it suffered from some drawbacks:
.dotrc file rather than loader optionsI've also taken the opportunity to include unit tests and hope to add more features as time permits.
FAQs
doT.js module loader for webpack
The npm package dotjs-loader receives a total of 778 weekly downloads. As such, dotjs-loader popularity was classified as not popular.
We found that dotjs-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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.