nodeletter

Nodeletter is a Node.js module that is used for creating email newsletters.

npm install nodeletter
12 downloads in the last week
27 downloads in the last month

nodeletter

vr. 0.1.5

nodeletter is a Node.js module that can be used for creating email newsletters.

It was developed and has been tested on Node.js vr. 0.8.18.

nodeletter requires the following modules:

  • http
  • fs
  • path
  • url
  • moment
  • async
  • jquery
  • inliner
  • premailer
  • markdown
  • kiwi

Synopsis

This Node module is intended for developers/designers tasked with creating a unique newsletter design for email. Normally services like MailChimp, etc., are good routes to go for such efforts. But, if you're stuck creating a solution from scratch to handle through some distribution service, that usually means you're in for a lot of trivial work, including:

  • using antiquated HTML/CSS strategies to lay out content (grr)
  • testing with numerous email browsers (yuck)
  • embedding CSS inline as style attributes for MUA's that don't process header or inline CSS (wut)
  • making sure all links are referencing valid external location (mmph)
  • having multiple copies of the same design for email/online display (hnngghh)
  • entering content into source directly (&@#$D!)
  • updating context sensitive variables (dates, names, etc.) (sigh)
  • remembering to create a text version (aw, crap)

nodeletter attempts to solve at least some of these problems from the get go, or at least make your life easier. A more over-arching goal is to make newsletter development more akin to common web development.

Process

nodeletter separates newsletter creation into concerns you're used to when developing for the front-end interwebz.

Render Modes

Render modes refer to sets of behavior by which *nodeletter will render an existing email template. By default, the following render modes are supplied (and are overrideable):

  • email: CSS is inlined, compiled into the DOM as style attributes, and compressed, link references are made external
  • online: CSS is inlined, references are made external
  • default: the template is served with no intermediate processing

Template

nodeletter newsletters are created using the Kiwi templating engine, which is itself based on jQuery Templates.

Content

Content refers to what is featured in your newsletter, which is usually text like an article, or whatever.

Content is derived using markdown. Simply create a markdown file and include it in your template within the ./contents folder.

Feeds

Feeds are lists of items that a newsletter might use, like a list of news items, events, or links.

Feeds are derived using JSON files that are imported from ./contents/feeds.json.

Statics

Static files are your CSS, JS, and images. These are smartly handled depending on your defined render modes.

Editions

Obviously you want to be able to create different editions (digest, volumes, versions, whatever) of your newsletter. Normally email newsletters are sent out once a month, week, year, etc.

To handle this, content and static files are overrideable according to the path which you supply to the nodeletter url.

As an example, say we release a newsletter monthly and I want to create a newsletter for March, 2013.

Content

  1. Create a folder structure under content: /2013/03
  2. Put your junk in that folder
  3. Get your browser to open the folder by visiting: http://<url_to_nodeletter>/2013/03
  4. And that's how you do it

Note: nodeletter will ONLY look for content within the subdirectory you give it.

Statics

  1. Create a folder structure under content (not static): /2013/03/static
  2. Put your junk in that folder
  3. Etc.

Note: nodeletter will OVERRIDE static files it finds in the subdirectory, but also load static files from the main static directory.

Usage

  1. Build the directory structure using the nodeletter executable.

    nodeletter create template_name

    This uses the nodeletter project template to get you started.

  2. Configure things appropriately in the .js file (like base path and such).

  3. Get crackin' on your sweet newsletter (Kiwi template, generation logic, styles, images, content, Hobbits, etc.).

    If you want some markup to start with, I suggest taking a look at MailChimps excellent email newsletter templates

  4. Start the nodeletter server.

    node template.js

  5. Define render modes for developing and testing your newsletter. Render modes are displayed according to the specified path:

    localhost:8888/edition/path?rm=<render_mode>

    where:

    • render_mode: type of render mode, default is default
  6. If a render mode is set given the "generate: true" option, it will save the produced output to the content path under '.gen'

Status

This project is in its infancy but is being actively developed. Let me know you have any problems.

License

MIT License

Copyright (C) 2013 Matthew Coleman

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you