email-templates
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -49,3 +49,3 @@ // node-email-templates | ||
// Check if `that.bufferType` is not an empty string, so we'll use the | ||
// Check if `that.bufferType` is not an empty string, so we'll use the | ||
// global bufferType instead. | ||
@@ -67,5 +67,9 @@ if (that.bufferType !== '') { | ||
var htmlOpts = {resourcePrefix: 'html', source: html, locals: locals} | ||
, textOpts = {resourcePrefix: 'text', source: text, locals: locals} | ||
, cssOpts = {resourcePrefix: 'style', source: stylesheet, locals: locals} | ||
// Configure options for template and stylesheet files. | ||
var htmlOpts = { source: html, locals: locals } | ||
, textOpts = { source: text, locals: locals } | ||
, cssOpts = { source: stylesheet, locals: locals }; | ||
htmlOpts.filename = glob.sync(path.join(locals.templatePath, 'html*'))[0]; | ||
textOpts.filename = glob.sync(path.join(locals.templatePath, 'text*'))[0]; | ||
cssOpts.filename = glob.sync(path.join(locals.templatePath, 'style*'))[0]; | ||
@@ -78,3 +82,3 @@ // Render all templates and stylesheets. | ||
stylesheet = results[2] | ||
// Inject available styles into HTML. | ||
@@ -156,3 +160,3 @@ html = (stylesheet) ? juice(html, stylesheet) : html | ||
// Ensure the `templateName` is valid | ||
if (templateName === 'undefined') return callback('templateName was not defined'); | ||
if (templateName === undefined) return callback('templateName was not defined'); | ||
@@ -170,5 +174,4 @@ // Set the full path to the template | ||
// Ensure that at least the html.ejs file exists inside | ||
that.html = glob.sync(templatePath + '/html*')[0]; | ||
//that.html = path.join(templatePath, 'html.ejs'); | ||
// Ensure that at least an html file exists inside | ||
that.html = glob.sync(templatePath + '/html*')[0] || ''; | ||
fs.stat(that.html, function(err, stats) { | ||
@@ -175,0 +178,0 @@ |
@@ -1,9 +0,8 @@ | ||
/** | ||
/** | ||
* Small utility module for compling HTML templates or pre-processed CSS. | ||
* | ||
* @author: [@jasonsims]('https://github.com/jasonsims') | ||
* | ||
* @author: [@jasonsims]('https://github.com/jasonsims') | ||
*/ | ||
var glob = require('glob') | ||
, path = require('path') | ||
var path = require('path') | ||
, ejs = require('ejs') | ||
@@ -37,11 +36,8 @@ , jade = require('jade') | ||
var locals = options.locals | ||
, source = options.source | ||
, resourceRegex = options.resourcePrefix + '*' | ||
, searchPath = path.join(locals.templatePath, resourceRegex) | ||
locals.filename = glob.sync(searchPath)[0]; | ||
, source = options.source; | ||
locals.filename = options.filename; | ||
locals.engine = path.extname(locals.filename); | ||
this.engineMap[locals.engine](source, locals, cb) | ||
} | ||
} | ||
@@ -72,3 +68,6 @@ | ||
function renderStylus(source, locals, cb) { | ||
stylus.render(source, locals, cb) | ||
// Render stylus synchronously as it does not appear to handle asynchronous | ||
// calls properly when an error is generated. | ||
var css = stylus.render(source, locals) | ||
cb(null, css) | ||
} | ||
@@ -75,0 +74,0 @@ function renderStyl(source, locals, cb) { |
103
package.json
{ | ||
"name": "email-templates" | ||
, "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.3" | ||
, "author": "Nick Baugh <niftylettuce@gmail.com>" | ||
, "contributors": [ | ||
{ "name": "Nick Baugh", "email": "niftylettuce@gmail.com" } | ||
, { "name": "Andrea Baccega", "email": "vekexasia@gmail.com" } | ||
, { "name": "Nic Jansma", "web": "http://nicj.net" } | ||
, { "name": "Jason Sims", "email": "sims.jrobert@gmail.com" } | ||
] | ||
, "keywords": [ "node-email-templates", "windows", "ejs", "email", "templates", "email-templates", "juice", "inline", "css" ] | ||
, "homepage": "https://github.com/niftylettuce/node-email-templates" | ||
, "repository": { | ||
"type": "git" | ||
, "url": "https://github.com/niftylettuce/node-email-templates.git" | ||
"name": "email-templates", | ||
"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.4", | ||
"author": "Nick Baugh <niftylettuce@gmail.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Nick Baugh", | ||
"email": "niftylettuce@gmail.com" | ||
}, | ||
{ | ||
"name": "Andrea Baccega", | ||
"email": "vekexasia@gmail.com" | ||
}, | ||
{ | ||
"name": "Nic Jansma", | ||
"web": "http://nicj.net" | ||
}, | ||
{ | ||
"name": "Jason Sims", | ||
"email": "sims.jrobert@gmail.com" | ||
} | ||
, "engines": { | ||
"node": ">= 0.6.0" | ||
} | ||
, "main": "lib/main.js" | ||
, "dependencies": { | ||
"ejs": "0.8.3" | ||
, "juice": "~0.3.2" | ||
, "async": "0.1.22" | ||
, "underscore": "~1.6.0" | ||
, "combined-stream": "~0.0.4" | ||
, "swig": "~1.3.2" | ||
, "jade": "~1.1.5" | ||
, "handlebars": "~1.3.0" | ||
, "glob": "~3.2.8" | ||
, "stylus": "~0.42.2" | ||
, "styl": "~0.2.7" | ||
, "node-sass": "~0.8.1" | ||
, "less": "~1.7.0" | ||
], | ||
"keywords": [ | ||
"node-email-templates", | ||
"windows", | ||
"ejs", | ||
"email", | ||
"templates", | ||
"email-templates", | ||
"juice", | ||
"inline", | ||
"css" | ||
], | ||
"homepage": "https://github.com/niftylettuce/node-email-templates", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/niftylettuce/node-email-templates.git" | ||
}, | ||
"engines": { | ||
"node": ">= 0.6.0" | ||
}, | ||
"main": "lib/main.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha --reporter spec --ui bdd" | ||
}, | ||
"dependencies": { | ||
"ejs": "0.8.3", | ||
"juice": "~0.3.2", | ||
"async": "0.1.22", | ||
"underscore": "~1.6.0", | ||
"combined-stream": "~0.0.4", | ||
"swig": "~1.3.2", | ||
"jade": "~1.1.5", | ||
"handlebars": "~1.3.0", | ||
"glob": "~3.2.8", | ||
"stylus": "~0.42.2", | ||
"styl": "~0.2.7", | ||
"node-sass": "~0.8.1", | ||
"less": "~1.7.0" | ||
}, | ||
"devDependencies": { | ||
"nodemailer": "0.3.27", | ||
"postmark": "0.1.6", | ||
"mocha": "~1.17.1", | ||
"chai": "^1.9.0", | ||
"mkdirp": "^0.3.5", | ||
"rimraf": "^2.2.6" | ||
} | ||
, "devDependencies": { | ||
"nodemailer": "0.3.27" | ||
, "postmark": "0.1.6" | ||
} | ||
} |
@@ -414,2 +414,4 @@ # 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/email-templates-windows) [![Gittip](http://img.shields.io/gittip/niftylettuce.png)](https://www.gittip.com/niftylettuce/) | ||
* 0.1.4 - Bug fixes, basic integration and unit tests for future iterations, abstracted templateManager, all thanks to @jasonsims | ||
* 0.1.3 - Added support for various CSS pre-processes thanks to @jasonsims | ||
@@ -416,0 +418,0 @@ |
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
46336
18
735
473
6
2