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
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -352,11 +352,13 @@ Promise
352
352
353
353
### Cache Pug Templates
354
354
355
+
Out of the box, templates are cached as they are compiled (e.g. as emails are sent, the template they're using is cached). However these templates are not cached in-advance, so the first emails sent of each template will be slower to send.
356
+
355
357
We strongly suggest to pre-cache your templates with [cache-pug-templates][] (if you're using the default [Pug][] template engine).
356
358
357
359
If you do not do this, then your Pug templates will re-compile and re-cache every time you deploy new code and restart your app.
358
360
359
-
Note that you will need to specify the `views` option to your `new CachePugTemplates({ views: '...' });` instance, with `views` being a file path (Array or String) to your email template directory.
361
+
Note that you will need to specify the `views` option to your `new CachePugTemplates({ views: '...' });` instance, with `views` being a file path (Array or String) to your email template directory. See [cache-pug-templates][] documentation for more information.
360
362
361
363
### Localization
362
364
@@ -681,6 +683,7 @@ For a list of all available options and defaults [view the configuration object]
681
683
*`map` (Object) - a template file extension mapping, defaults to `{ hbs: 'handlebars', njk: 'nunjucks' }` (this is useful if you use different file extension naming conventions)
682
684
*`engineSource` (Object) - the default template engine source, defaults to [consolidate][]
683
685
*`locals` (Object) - locals to pass to templates for rendering
686
+
*`cache` (Boolean) - defaults to `false` for `development` and `test` environments, and `true` for all others (via `process.env.NODE_ENV`), whether or not to cache templates
684
687
*`pretty` (Boolean) - defaults to `true`, but is automatically set to `false` for subject templates and text-based emails
685
688
*`message` (Object) - default [Nodemailer message object][nodemailer-message-object] for messages to inherit (defaults to an empty object `{}`)
686
689
*`send` (Boolean) - whether or not to send emails, defaults to `false` for `development` and `test` environments, and `true` for all others (via `process.env.NODE_ENV`) (**NOTE: IF YOU ARE NOT USING `NODE_ENV` YOU WILL NEED TO MANUALLY SET THIS TO `true`**)
0 commit comments