
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
email-template-renderer
Advanced tools
[](https://travis-ci.org/tmont/email-template-renderer) [](http://badge.fury.io/js/email-template-renderer)
This is a little library that allows you to easily compile templated HTML into the pile of hot garbage that HTML email clients require. It makes a few things easier:
For example, it will turn this:
//- /my/templates/examples/test.jade
html
head
link(rel="stylesheet", href="./style.css")
body
p Hello #{hello}
/* style.css */
p {
color: red;
}
into this:
<html>
<head>
</head>
<body>
<p style="color: red;">Hello world</p>
</body>
</html>
by doing this:
var Renderer = require('email-template-renderer'),
renderer = new Renderer('/my/templates');
renderer.render('examples', { hello: 'world' }, function(err, result) {
if (err) {
console.error(err);
return;
}
console.log(result.test);
});
Basically, you have to set up your templates in a particular directory structure. Something like this:
templates
|- reset-password
|-- text.jade
|-- html.jade
|-- style.css
|- registration
|-- text.jade
|-- html.jade
|-- style.css
The idea being that each directory (reset-password
and registration
above) would contain
different templates. A common theme is to have an HTML template and a text template. You can
use jade/ejs for both. If your template is named text.<whatever>
it will not be juice
d.
You would then pass /path/to/that/templates
directory into the renderer. Then you just call
render
and give it the name of the template to render as well as any template variables, and
it returns an object with each key being each template inside the template directory.
For example, the result would be something like the following for the reset-password
template
above:
{
text: 'Click on this link to reset your password: http://example.com/asdf',
html: '<a style="color: blue; text-decoration: underline;" href="http://example.com/asdf">Click here</a> to reset your password.'
}
NOTE You will have to load the template library yourself. This library does not have any dependencies on template libraries, so it's up to you to ensure that the templating language is being loaded.
FAQs
[](https://travis-ci.org/tmont/email-template-renderer) [](http://badge.fury.io/js/email-template-renderer)
The npm package email-template-renderer receives a total of 3 weekly downloads. As such, email-template-renderer popularity was classified as not popular.
We found that email-template-renderer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.