Skip to content

Commit

Permalink
various tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mvoorberg committed May 14, 2018
1 parent d64e12d commit 5695732
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ npm install --save @transomjs/transom-ejs-template
## Usage
Transom-ejs-template is a simple module that provides a really simple way to send HTML (or text) formatted emails or even simple web pages.Using all the features of EJS, you can insert data into your templates or include other ejs templates etc.

After transom.initialize, an object is stored in the registry with 'transomTemplate' as the key. Each method will return a completely rendered template with all includes resoved and interpolated data.
After transom.initialize, an object is stored in the registry with 'transomTemplate' as the key. Each method will return a completely rendered template with all includes resolved and interpolated data.

### Render HTML templates
renderHtmlTemplate(templateName, data, htmlOptions)
Expand Down
9 changes: 4 additions & 5 deletions lib/ejsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module.exports = function TransomEjsHandler(server, options) {

// Navigate up out of the node_modules folder, to the root.
const templatePrefix = (data.environment === 'TESTING' ? path.join('..', 'test') : path.join('..', '..', '..', '..'));
const templatePath = path.join(templatePrefix, opts.templatePath || template.htmlTemplatePath || 'templateHtml');
const filename = path.join(__dirname, templatePath, `${templateName}.ejs`);
const templatePath = opts.templatePath || template.htmlTemplatePath || 'templateHtml';
const filename = path.join(__dirname, templatePrefix, templatePath, `${templateName}.ejs`);

if (!fs.existsSync(filename)) {
debug('HTML template not found', filename);
Expand All @@ -47,11 +47,10 @@ module.exports = function TransomEjsHandler(server, options) {
data.environment = (process.env.NODE_ENV || 'DEVELOPMENT').toUpperCase();
data.templateName = templateName;


// Navigate up out of the node_modules folder, to the root.
const templatePrefix = (data.environment === 'TESTING' ? path.join('..', 'test') : path.join('..', '..', '..', '..'));
const templatePath = path.join(templatePrefix, opts.templatePath || template.emailTemplatePath || 'templateEmail');
const filename = path.join(__dirname, templatePath, `${templateName}.ejs`);
const templatePath = opts.templatePath || template.emailTemplatePath || 'templateEmail';
const filename = path.join(__dirname, templatePrefix, templatePath, `${templateName}.ejs`);

if (!fs.existsSync(filename)) {
debug('Email template not found', filename);
Expand Down

0 comments on commit 5695732

Please sign in to comment.