Permalink
Browse files

Merge branch 'master' into windows

  • Loading branch information...
niftylettuce committed Sep 12, 2012
2 parents c1e7cd3 + c258547 commit e076b49858051ec83623e4f8244876cd06c0467d
Showing with 78 additions and 9 deletions.
  1. +50 −0 .jshintrc
  2. +6 −5 Readme.md
  3. +17 −3 lib/main.js
  4. +5 −1 package.json
View
@@ -0,0 +1,50 @@
+{
+ "predef": [
+ "jasmine",
+ "spyOn",
+ "it",
+ "console",
+ "describe",
+ "expect",
+ "beforeEach",
+ "waits",
+ "waitsFor",
+ "runs",
+ "alert",
+ "confirm",
+ "Modernizr",
+ "impress",
+ "exports",
+ "self"
+ ],
+
+ "node" : true,
+ "es5" : true,
+ "browser" : true,
+ "jquery": true,
+
+ "boss" : false,
+ "curly": false,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": false,
+ "laxbreak": true,
+ "laxcomma": true,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": false,
+ "indent": 2,
+ "asi": true
+}
View
@@ -1,9 +1,10 @@
-# node-email-templates <sup>0.0.2</sup>
+# node-email-templates <sup>0.0.3</sup>
Node.js module for rendering beautiful emails with [ejs][1] templates and email-friendly inline CSS using [juice][2].
-**NEW**: Added support for custom EJS options such as opening and closing tags (instead of `<%` and `%>`). See documentation below for more information.
+**New in v0.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
@@ -32,9 +33,9 @@ npm install email-templates-windows
2. Create a folder called `templates` inside your root directory (or elsewhere).
3. For each of your templates, respectively name and create a folder inside the `templates` folder.
4. Add the following files inside the template's folder:
- * `html.ejs` - html + [ejs][1] version of your email template
- * `text.ejs` - text + [ejs][1] version of your email template
- * `style.css` - stylesheet for the template, which will render `html.ejs` with inline CSS (optional)
+ * `html.ejs` - html + [ejs][1] version of your email template (**required**)
+ * `text.ejs` - text + [ejs][1] version of your email template (**optional**)
+ * `style.css` - stylesheet for the template, which will render `html.ejs` with inline CSS (**optional**)
5. Utilize one of the examples below for your respective email module and start sending beautiful emails!
View
@@ -113,12 +113,12 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
that.text = path.join(templatePath, 'text.ejs');
that.stylesheet = path.join(templatePath, 'style.css');
- async.map([that.text, that.stylesheet], fs.stat, function(err, results) {
+ async.map([that.text, that.stylesheet], checkExists, function(err, results) {
if (err) return callback(err);
- if (!results[0].isFile()) that.text = false;
- if (!results[1].isFile()) that.stylesheet = false;
+ that.text = results[0];
+ that.stylesheet = results[1];
if (that.text && that.stylesheet) {
async.map([that.text, that.stylesheet], fs.readFile, function(err, results) {
@@ -149,10 +149,24 @@ var EmailTemplate = function(templateDirectory, defaults, done) {
}
});
+
+
});
});
});
});
+
+ function checkExists(item, callback) {
+ function cb(exists) {
+ return callback(null, exists)
+ }
+ // node >= v0.8.x
+ if (fs.exists) return fs.exists(item, cb)
+ // other versions of node fallback to path.exists
+ return path.exists(item, cb)
+ }
+
+
});
};
View
@@ -1,7 +1,7 @@
{
"name": "email-templates-windows"
, "description": "Node.js module for rendering beautiful emails with ejs templates and email-friendly inline CSS using juice."
- , "version": "0.0.2"
+ , "version": "0.0.3"
, "author": "Nick Baugh <niftylettuce@gmail.com>"
, "contributors": [
{ "name": "Nick Baugh", "email": "niftylettuce@gmail.com" }
@@ -22,4 +22,8 @@
, "async": "0.1.22"
, "underscore": "1.3.3"
}
+ , "devDependencies": {
+ "nodemailer": "0.3.27"
+ , "postmark": "0.1.6"
+ }
}

0 comments on commit e076b49

Please sign in to comment.