diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1b34ce9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +The MIT License + +Copyright (c) 2012- Nick Baugh (http://niftylettuce.com/) + +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. diff --git a/Readme.md b/Readme.md index 6d73151..80d5bfd 100644 --- a/Readme.md +++ b/Readme.md @@ -3,39 +3,31 @@ Node.js module for rendering beautiful emails with [ejs][1] templates and email-friendly inline CSS using [juice][2]. -**UPDATE**: [Teelaunch](https://github.com/teelaunch) plans to rewrite this module, subscribe to their [email newsletter](http://goo.gl/j0ypI) for special updates. +Follow [@niftylettuce](http://twitter.com/niftylettuce) on Twitter for updates. -**v0.0.9**: -* Fixed `juice` dependency issue +Like this module? Check out [express-cdn](https://github.com/niftylettuce/express-cdn)! -**v0.0.7**: -* Added support for ejs's `include` directive thanks to @nicjansma -**v0.0.6**: -* Fixed batch problem (`...has no method slice`) thanks to @vekexasia +## Index -**v0.0.5**: -* Added support for an optional [zlib][8] compression type (e.g. you can return compressed html/text buffer for db storage) +* [Email Templates](#email-templates) +* [Installation](#installation) +* [Quick Start](#quick-start) +* [EJS Custom Tags](#ejs-custom-tags) +* [Examples](#examples) + * [Basic](#basic) + * [Nodemailer](#nodemailer) + * [Postmark](#postmark) +* [Changelog](#changelog) +* [Contributors](#contributors) +* [License](#license) -```bash -... -template('newsletter', locals, 'deflateRaw', function(err, html, text) { - // The `html` and `text` are buffers compressed using zlib.deflateRaw - // - // **NOTE**: You could also pass 'deflate' or 'gzip' if necessary, and it works with batch rendering as well -}) -... -``` - -**v0.0.4 (with bug fix for 0.0.3)**: -* Removed requirement for `style.css` and `text.ejs` files with compatibility in `node` v0.6.x to v0.8.x (utilizes `path.exists` vs. `fs.exists` respectively). ## Email Templates For professional and customizable email templates, please visit . - ## Installation ### Unix/OS X @@ -51,7 +43,7 @@ npm install email-templates-windows ``` -## Quick start +## Quick Start 1. Install the module for your respective project `npm install email-templates`. 2. Create a folder called `templates` inside your root directory (or elsewhere). @@ -64,7 +56,7 @@ npm install email-templates-windows 6. Utilize one of the examples below for your respective email module and start sending beautiful emails! -# EJS Custom Tags +## EJS Custom Tags Want to use different opening and closing tags instead of the EJS's default `<%` and `%>`?. @@ -76,7 +68,10 @@ emailTemplates(templatesDir, { open: '{{', close: '}}' }, function(err, template **NOTE**: You can also pass other options from EJS's documentation. -# Usage + +## Examples + +### Basic Render a template for a single email or render multiple (having only loaded the template once). @@ -117,9 +112,7 @@ emailTemplates(templatesDir, function(err, template) { }); ``` - - -## Example with [Nodemailer][3] +### [Nodemailer][3] ```js var path = require('path') @@ -234,7 +227,7 @@ emailTemplates(templatesDir, function(err, template) { } }; this.batch = function(batch) { - batch(this.locals, this.send); + batch(this.locals, templatesDir, this.send); }; }; @@ -250,9 +243,9 @@ emailTemplates(templatesDir, function(err, template) { }); ``` +### [Postmark][4] - -## Example with [Postmark App][4] (utilizing [Postmark.js][5]) +This example utilizes [Postmark.js][5]. **NOTE**: Did you know `nodemailer` can also be used to send SMTP email through Postmark? See [this section][6] of their Readme for more info. @@ -353,7 +346,7 @@ emailTemplates(templatesDir, function(err, template) { } }; this.batch = function(batch) { - batch(this.locals, this.send); + batch(this.locals, templatesDir, this.send); }; }; @@ -370,6 +363,28 @@ emailTemplates(templatesDir, function(err, template) { ``` +## Changelog + +* 0.0.9 - Fixed `juice` dependency issue + +* 0.0.8 - Minor updates + +* 0.0.7 - Added support for ejs's `include` directive thanks to @nicjansma + +* 0.0.6 - Fixed batch problem (`...has no method slice`) thanks to @vekexasia + +* 0.0.5 - Added support for an optional [zlib][8] compression type (e.g. you can return compressed html/text buffer for db storage) + + ```bash + template('newsletter', locals, 'deflateRaw', function(err, html, text) { + // The `html` and `text` are buffers compressed using zlib.deflateRaw + // + // **NOTE**: You could also pass 'deflate' or 'gzip' if necessary, and it works with batch rendering as well + }) + ``` + +* 0.0.4 (with bug fix for 0.0.3) - Removed requirement for `style.css` and `text.ejs` files with compatibility in `node` v0.6.x to v0.8.x (utilizes `path.exists` vs. `fs.exists` respectively). + ## Contributors @@ -380,8 +395,15 @@ emailTemplates(templatesDir, function(err, template) { ## License -MIT Licensed +The MIT License + +Copyright (c) 2012- Nick Baugh (http://niftylettuce.com/) + +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. [1]: https://github.com/visionmedia/ejs diff --git a/examples/nodemailer/index.js b/examples/nodemailer/index.js index de03a15..ae6a568 100644 --- a/examples/nodemailer/index.js +++ b/examples/nodemailer/index.js @@ -115,7 +115,7 @@ emailTemplates(templatesDir, function(err, template) { } }; this.batch = function(batch) { - batch(this.locals, this.send); + batch(this.locals, templatesDir, this.send); }; }; diff --git a/examples/postmark/index.js b/examples/postmark/index.js index 57dc99d..35b5374 100644 --- a/examples/postmark/index.js +++ b/examples/postmark/index.js @@ -105,7 +105,7 @@ emailTemplates(templatesDir, function(err, template) { } }; this.batch = function(batch) { - batch(this.locals, this.send); + batch(this.locals, templatesDir, this.send); }; }; diff --git a/package.json b/package.json index e14a96d..9604013 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "email-templates" , "description": "Node.js module for rendering beautiful emails with ejs templates and email-friendly inline CSS using juice." - , "version": "0.0.9" + , "version": "0.1.0" , "author": "Nick Baugh " , "contributors": [ { "name": "Nick Baugh", "email": "niftylettuce@gmail.com" }