npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

derby-email

v2.0.0

Published

Create emails using Derby JS apps/templates.

Downloads

10

Readme

Derby Email

Create emails using Derby JS apps/templates. It uses derby-render to render views and juice to inline styles.

Build Status

For convenience, the default results returned match the values read by nodemailer.

Installation

$ npm install derby-email --save

Usage

Create your views:

index.html

<import: src="./other">

<From:>
  {{unescaped $formatEmail('app', '[email protected]')}}

<Body:>
  <p>Some text.</p>

<Text:>
  Some text.

Any view named after a field and capitalized will be returned as a result.

other.html

<Subject:>
  Hello {{user}}

<Body:>
  <p>foo bar</p>

<Text:>
  foo bar

Send your email:

var derby = require('derby');
var app = derby.createApp('app', __filename);
var email = require('derby-email')(app);
var nodemailer = require('nodemailer');
app.loadViews(...);
app.loadStyles(...);

function send(err, emailOptions) {
  var transporter = nodemailer.createTransports(...);
  transporter.send(emailOptions, function (err, info) {
    ...
  })
};

// return email options
email(send);

// with data
var data = {_page: {userId: '...'}};
email(data, send);

// with a specific page (namespace)
email('welcome', send);

// or with both
email('welcome', data, send);

View Functions

The following view functions are available in your views:

$formatEmail(name, address) – Returns a formatted email address. i.e. name <[email protected]>.

Options

All options are also passed in to derby-render. See derby-render for a list of options.

fields – The fields (views) to render and return. Includes: html, text, subject, from, to, etc. See Nodemailer for a list of suggested fields.

css – Configuration options passed to inline-css. See [inline-css]https://github.com/jonkemp/inline-css).