You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: performance improvement with asynchronous parallel rendering, removed bluebird, support Node v8.x+ only, preview-email new configuration (ability to use custom stylesheets)
Copy file name to clipboardExpand all lines: README.md
+53-20Lines changed: 53 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,6 @@
11
11
12
12
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][].
13
13
14
-
**Still on v4.x?**: v5.x is released with only one minor breaking change, see [breaking changes below](#v5-breaking-changes).
15
-
16
-
**Still on v2.x?**: v3.x is released (you'll need Node v6.4.0+); see [breaking changes below](#v3-breaking-changes). [2.x branch][2-x-branch] docs available if necessary.
17
-
18
14
19
15
## Table of Contents
20
16
@@ -38,8 +34,11 @@ Create, [preview][preview-email], and send custom email templates for [Node.js][
38
34
*[Open Email Previews in Firefox](#open-email-previews-in-firefox)
39
35
*[Options](#options)
40
36
*[Plugins](#plugins)
41
-
*[V5 Breaking Changes](#v5-breaking-changes)
42
-
*[V3 Breaking Changes](#v3-breaking-changes)
37
+
*[Breaking Changes](#breaking-changes)
38
+
*[v6.0.0](#v600)
39
+
*[v5.0.0](#v500)
40
+
*[v4.0.0](#v400)
41
+
*[v3.0.0](#v300)
43
42
*[Tip](#tip)
44
43
*[Related](#related)
45
44
*[Contributors](#contributors)
@@ -69,15 +68,13 @@ We've added [preview-email][] by default to this package!
69
68
70
69
This means that (by default) in the development environment (e.g. `NODE_ENV=development`) your emails will be rendered to the tmp directory for you and automatically opened in the browser.
71
70
72
-
If you have trouble previewing emails in your browser, you can configure a `preview` option which gets passed along to [opn's options][opn-options] (e.g. `{ app: 'firefox' }`). See the example below for [Open Email Previews in Firefox](#open-email-previews-in-firefox).
71
+
If you have trouble previewing emails in your browser, you can configure a `preview` option which gets passed along to [open's options][open-options] (e.g. `preview: { open: { app: 'firefox' } }`).
73
72
74
-
<atarget="_blank"href="https://github.com/niftylettuce/preview-email/blob/master/demo.png">View the demo</a>
73
+
See the example below for [Open Email Previews in Firefox](#open-email-previews-in-firefox).
75
74
76
75
77
76
## Usage
78
77
79
-
> **UPGRADING?** If you are upgrading from v2 to v3, see [v3 Breaking Changes](#v3-breaking-changes) below. You'll need Node v6.4.0+ now.
80
-
81
78
### Debugging
82
79
83
80
#### Environment Flag
@@ -657,16 +654,18 @@ email
657
654
658
655
### Open Email Previews in Firefox
659
656
660
-
The `preview` option can be a custom Object of options to pass along to [opn's options][opn-options].
657
+
The `preview` option can be a custom Object of options to pass along to [open's options][open-options].
661
658
662
659
> Firefox example:
663
660
664
661
```js
665
662
constemail=newEmail({
666
663
// ...
667
664
preview: {
668
-
app:'firefox',
669
-
wait:false
665
+
open: {
666
+
app:'firefox',
667
+
wait:false
668
+
}
670
669
}
671
670
});
672
671
```
@@ -731,12 +730,42 @@ We also highly recommend to add to your default `config.locals` the following:
731
730
*[font-awesome-assets][] - render any [Font Awesome][fa] icon as an image in an email w/retina support (no more Photoshop or Sketch exports!)
732
731
733
732
734
-
## V5 Breaking Changes
733
+
## Breaking Changes
734
+
735
+
See the [Releases](https://github.com/niftylettuce/email-templates/releases) page for an up to date changelog.
736
+
737
+
### v6.0.0
738
+
739
+
* Performance should be significantly improved as the rendering of subject, html, and text parts now occurs asynchronously in parallel (previously it was in series and had blocking lookup calls).
740
+
* We removed [bluebird][] and replaced it with a lightweight alternative [pify][] (since all we were using was the `Promise.promisify` method from `bluebird` as well).
741
+
* This package now only supports Node v8.x+ (due to [preview-email][]'s [open][] dependency requiring it).
742
+
* Configuration for the `preview` option has slightly changed, which now allows you to [specify a custom template and stylesheets](https://github.com/niftylettuce/preview-email#custom-preview-template-and-stylesheets) for preview rendering.
743
+
744
+
> If you were using a custom `preview` option before, you will need to change it slightly:
735
745
736
-
In version 5.x+, we changed the order of defaults being set. See [#313](https://github.com/niftylettuce/email-templates/issues/313) for more information. This allows you to override message options such as `from` (even if you have a global default `from` set).
746
+
```diff
747
+
const email = new Email({
748
+
// ...
749
+
preview: {
750
+
+ open: {
751
+
+ app: 'firefox',
752
+
+ wait: false
753
+
+ }
754
+
- app: 'firefox',
755
+
- wait: false
756
+
}
757
+
});
758
+
```
759
+
760
+
### v5.0.0
761
+
762
+
In version 4.x+, we changed the order of defaults being set. See [#313](https://github.com/niftylettuce/email-templates/issues/313) for more information. This allows you to override message options such as `from` (even if you have a global default `from` set).
763
+
764
+
### v4.0.0
737
765
766
+
See v5.0.0 above
738
767
739
-
##V3 Breaking Changes
768
+
### v3.0.0
740
769
741
770
> If you are upgrading from v2 or prior to v3, please note that the following breaking API changes occurred:
742
771
@@ -774,7 +803,7 @@ In version 5.x+, we changed the order of defaults being set. See [#313](https:/
774
803
775
804
5. 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.
776
805
777
-
6. There are new options `options.send` and `options.preview`. Both are Boolean values and configured automatically based off the environment. Take a look at the [configuration object](src/index.js). Note that you can optionally pass an Object to `preview` option, which gets passed along to [opn's options][opn-options].
806
+
6. There are new options `options.send` and `options.preview`. Both are Boolean values and configured automatically based off the environment. Take a look at the [configuration object](src/index.js). Note that you can optionally pass an Object to `preview` option, which gets passed along to [open's options][open-options].
778
807
779
808
7. If you wish to send emails in development or test environment (disabled by default), set `options.send` to `true`.
780
809
@@ -827,8 +856,6 @@ Instead of having to configure this for yourself, you could just use [Lad][] ins
0 commit comments