email-templates
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -16,6 +16,7 @@ // node-email-templates | ||
, async = require('async') | ||
, ejs = require('ejs') | ||
, juice = require('juice') | ||
, glob = require('glob') | ||
, zlib = require('zlib') | ||
, _ = require('underscore') | ||
, tm = require('./templateManager') | ||
@@ -63,7 +64,12 @@ var validBufferTypes = [ 'deflate', 'deflateRaw', 'gzip' ] | ||
locals = _.defaults(locals, (typeof defaults === 'object') ? defaults : {}); | ||
locals.filename = path.join(templatePath, 'html.ejs'); | ||
html = ejs.render(html, locals); | ||
locals.filename = path.join(templatePath, 'text.ejs'); | ||
text = (text) ? ejs.render(text, locals) : ''; | ||
locals.filename = glob.sync(templatePath + '/html*')[0]; | ||
locals.engine = path.extname(locals.filename); | ||
html = tm(locals.engine).render(html, locals); | ||
locals.filename = glob.sync(templatePath + '/text*')[0]; | ||
locals.engine = path.extname(locals.filename); | ||
text = (text) ? tm(locals.engine).render(text, locals) : ''; | ||
if (stylesheet) html = juice(html, stylesheet); | ||
@@ -156,3 +162,4 @@ // return a compressed buffer | ||
// Ensure that at least the html.ejs file exists inside | ||
that.html = path.join(templatePath, 'html.ejs'); | ||
that.html = glob.sync(templatePath + '/html*')[0]; | ||
//that.html = path.join(templatePath, 'html.ejs'); | ||
fs.stat(that.html, function(err, stats) { | ||
@@ -173,4 +180,4 @@ | ||
// Set asset paths | ||
that.text = path.join(templatePath, 'text.ejs'); | ||
that.stylesheet = path.join(templatePath, 'style.css'); | ||
that.text = glob.sync(templatePath + '/text*')[0] || ''; | ||
that.stylesheet = glob.sync(templatePath + '/style*')[0] || ''; | ||
@@ -177,0 +184,0 @@ async.map([that.text, that.stylesheet], checkExists, function(err, results) { |
{ | ||
"name": "email-templates" | ||
, "description": "Node.js module for rendering beautiful emails with ejs templates and email-friendly inline CSS using juice." | ||
, "version": "0.1.1" | ||
, "description": "Node.js module for rendering beautiful emails with ejs, jade, swig, hbs, or handlebars templates and email-friendly inline CSS using juice." | ||
, "version": "0.1.2" | ||
, "author": "Nick Baugh <niftylettuce@gmail.com>" | ||
@@ -10,2 +10,3 @@ , "contributors": [ | ||
, { "name": "Nic Jansma", "web": "http://nicj.net" } | ||
, { "name": "Jason Sims", "email": "sims.jrobert@gmail.com" } | ||
] | ||
@@ -28,2 +29,6 @@ , "keywords": [ "node-email-templates", "ejs", "email", "templates", "email-templates", "juice", "inline", "css" ] | ||
, "combined-stream": "~0.0.4" | ||
, "swig": "~1.3.2" | ||
, "jade": "~1.1.5" | ||
, "handlebars": "~1.3.0" | ||
, "glob": "~3.2.8" | ||
} | ||
@@ -30,0 +35,0 @@ , "devDependencies": { |
@@ -1,9 +0,11 @@ | ||
[![Gittip](http://badgr.co/gittip/niftylettuce.png)](https://www.gittip.com/niftylettuce/) | ||
# node-email-templates [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/niftylettuce/node-email-templates/trend.png)](https://bitdeli.com/free "Bitdeli Badge") [![NPM version](https://badge.fury.io/js/email-templates.png)](http://badge.fury.io/js/node-email-templates) [![Gittip](http://img.shields.io/gittip/niftylettuce.png)](https://www.gittip.com/niftylettuce/) | ||
# node-email-templates <sup>[![Version Badge](http://vb.teelaun.ch/niftylettuce/node-email-templates.svg)](https://npmjs.org/package/email-templates)</sup> | ||
Node.js module for rendering beautiful emails with [jade][jade], [ejs][1], [swig][swig], [hbs][hbs], or [handlebars][handlebars] templates and email-friendly inline CSS using [juice][2]. | ||
Node.js module for rendering beautiful emails with [ejs][1] templates and email-friendly inline CSS using [juice][2]. | ||
[jade]: https://github.com/visionmedia/jade | ||
[swig]: https://github.com/paularmstrong/swig | ||
[hbs]: https://github.com/donpark/hbs | ||
[handlebars]: https://github.com/wycats/handlebars.js | ||
View these docs generated with [readme-docs](https://github.com/getprove/node-bootstrap-readme-docs) here: | ||
<http://niftylettuce.github.io/node-email-templates> | ||
View documentation here <http://documentup.com/niftylettuce/node-email-templates>. | ||
@@ -400,2 +402,4 @@ Follow [@niftylettuce](http://twitter.com/niftylettuce) on Twitter for updates. | ||
* 0.1.2 - Added support for other template languages (ejs, jade, swig, hbs, or handlebars) thanks to @jasonsims | ||
* 0.1.1 - Fixed long path issue for Windows | ||
@@ -431,4 +435,4 @@ | ||
* Nic Jansma (http://nicj.net) | ||
* Jason Sims <sims.jrobert@gmail.com> | ||
## License | ||
@@ -435,0 +439,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36253
16
454
457
9
+ Addedglob@~3.2.8
+ Addedhandlebars@~1.3.0
+ Addedjade@~1.1.5
+ Addedswig@~1.3.2
+ Addedamdefine@1.0.1(transitive)
+ Addedasync@0.2.10(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcharacter-parser@1.2.0(transitive)
+ Addedcommander@2.1.0(transitive)
+ Addedconstantinople@1.0.2(transitive)
+ Addedcss@1.0.8(transitive)
+ Addedcss-parse@1.0.4(transitive)
+ Addedcss-stringify@1.0.5(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addedglob@3.2.11(transitive)
+ Addedhandlebars@1.3.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-promise@1.0.1(transitive)
+ Addedjade@1.1.5(transitive)
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.3.0(transitive)
+ Addedminimist@0.0.10(transitive)
+ Addedmkdirp@0.3.5(transitive)
+ Addedmonocle@1.1.51(transitive)
+ Addedoptimist@0.3.70.6.1(transitive)
+ Addedpromise@2.0.0(transitive)
+ Addedreaddirp@0.2.5(transitive)
+ Addedsigmund@1.0.1(transitive)
+ Addedsource-map@0.1.34(transitive)
+ Addedswig@1.3.2(transitive)
+ Addedtransformers@2.1.0(transitive)
+ Addeduglify-js@2.2.52.3.62.4.02.4.24(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwith@2.0.0(transitive)
+ Addedwordwrap@0.0.20.0.3(transitive)
+ Addedyargs@3.5.4(transitive)