Skip to content

Commit

Permalink
Added backwards compatibility for 2.x juiceOptions and disableJuice
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Oct 12, 2017
1 parent 03320ca commit 0545e48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

> Create, [preview][preview-email], and send custom email templates for [Node.js][node]. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more! Made for sending beautiful emails with [Lad][].
>
> **NEW**: v3.0.0 is released! See the [2.x branch][2-x-branch] documentation if you're using an older version
> **NEW**: v3.x is released; see [breaking changes below](#v3-breaking-changes). [2.x branch][2-x-branch] docs available if necessary.

## Table of Contents
Expand Down Expand Up @@ -425,11 +425,7 @@ We also highly recommend to add to your default `config.locals` the following:
3. Localized template directories are no longer supported. We now support i18n translations out of the box. See [Localization](#localization) for more info.
4. The `options.juiceOptions` option has been changed to `options.juiceResources`.
5. The `options.disableJuice` option has been changed to `options.juice` and the Boolean should be negated. The default value for `options.juice` is `true`, therefore if you want to disable juice you will need to pass `options.juice = false`.
6. A new method `email.send` has been added. This allows you to create a Nodemailer transport and send an email template all at once (it calls `email.render` internally). See the [Basic](#basic) usage documentation above for an example.
4. A new method `email.send` has been added. This allows you to create a Nodemailer transport and send an email template all at once (it calls `email.render` internally). See the [Basic](#basic) usage documentation above for an example.
## Tip
Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ const juiceResources = require('juice-resources-promise');
class Email {
constructor(config = {}) {
debug('config passed %O', config);

// 2.x backwards compatible support
if (config.juiceOptions) {
config.juiceResources = config.juiceOptions;
delete config.juiceOptions;
}
if (config.disableJuice) {
config.juice = false;
delete config.disableJuice;
}

this.config = merge(
{
views: {
Expand Down

0 comments on commit 0545e48

Please sign in to comment.