diff --git a/.xo-config.js b/.xo-config.js index fd0bd7b..155da3f 100644 --- a/.xo-config.js +++ b/.xo-config.js @@ -2,5 +2,8 @@ module.exports = { prettier: true, space: true, extends: ['xo-lass'], - ignore: ['config.js'] + ignore: ['config.js'], + rules: { + 'unicorn/prefer-top-level-await': 'warn' + } }; diff --git a/README.md b/README.md index a8779a5..4ceaf11 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org) [![license](https://img.shields.io/github/license/forwardemail/email-templates.svg)](LICENSE) -Create, [preview][preview-email] (in the browser and in the iOS Simulator), 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 [Forward Email][forward-email] and [Lad][]. +Create, [preview][preview-email] (browser/iOS Simulator), and send custom email templates for [Node.js][node]. Made for [Forward Email][forward-email] and [Lad][]. ## Table of Contents @@ -19,7 +19,6 @@ Create, [preview][preview-email] (in the browser and in the iOS Simulator), and * [Attachments](#attachments) * [Automatic Inline CSS via Stylesheets](#automatic-inline-css-via-stylesheets) * [Render HTML and/or Text](#render-html-andor-text) - * [Cache Pug Templates](#cache-pug-templates) * [Localization](#localization) * [Text-Only Email (no HTML)](#text-only-email-no-html) * [Prefix Subject Lines](#prefix-subject-lines) @@ -30,8 +29,12 @@ Create, [preview][preview-email] (in the browser and in the iOS Simulator), and * [Absolute Path to Templates](#absolute-path-to-templates) * [Open Email Previews in Firefox](#open-email-previews-in-firefox) * [Options](#options) +* [Tips](#tips) + * [Purge unused CSS](#purge-unused-css) + * [Optimized Pug Stylesheet Loading](#optimized-pug-stylesheet-loading) * [Plugins](#plugins) * [Breaking Changes](#breaking-changes) + * [v11.0.0](#v1100) * [v10.0.0](#v1000) * [v9.0.0](#v900) * [v8.0.0](#v800) @@ -40,7 +43,6 @@ Create, [preview][preview-email] (in the browser and in the iOS Simulator), and * [v5.0.0](#v500) * [v4.0.0](#v400) * [v3.0.0](#v300) -* [Tip](#tip) * [Related](#related) * [Contributors](#contributors) * [License](#license) @@ -59,7 +61,7 @@ npm install email-templates pug ## Preview -We've added [preview-email][] by default to this package! This package allows you to preview emails in the browser and in the iOS Simulator. +We've added [preview-email][] by default to this package. This package allows you to preview emails in the browser and in the iOS Simulator. 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. @@ -255,7 +257,6 @@ const email = new Email({ tableElements: ['TABLE'] }, juiceResources: { - preserveImportant: true, webResources: { // // this is the relative directory to your CSS/image assets @@ -322,7 +323,6 @@ email .render({ path: 'mars/html', juiceResources: { - preserveImportant: true, webResources: { // view folder path, it will get css from `mars/style.css` relativeTo: path.resolve('mars') @@ -385,21 +385,11 @@ Promise .catch(console.error); ``` -### Cache Pug Templates - -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. - -We strongly suggest to pre-cache your templates with [cache-pug-templates][] (if you're using the default [Pug][] template engine). - -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. - -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. - ### Localization All you need to do is simply pass an [i18n][] configuration object as `config.i18n` (or an empty one as this example shows to use defaults). -> Don't want to handle localization and translation yourself? Just use [Lad][lad] – it's built in and uses [mandarin][] (with automatic Google Translate support) under the hood! +> Don't want to handle localization and translation yourself? Just use [Lad][lad] – it's built in and uses [mandarin][] (with automatic Google Translate support) under the hood. ```js const Email = require('email-templates'); @@ -790,7 +780,8 @@ For a list of all available options and defaults [view the configuration object] * `subjectPrefix` (Boolean or String) - defaults to `false`, but if set to a string it will use that string as a prefix for your emails' subjects * `juice` (Boolean) - whether or not to use [juice][] when rendering templates (defaults to `true`) (note that if you have a custom rendering function you will need to implement [juice][] in it yourself) * `juiceResources` (Object) - options to pass to `juice.juiceResources` method (only used if `juice` option is set to `true`, see [juice's][juice] API for more information - * `preserveImportant` (Boolean) - defaults to `true` + * `applyStyleTags` (Boolean) - defaults to `false` (as of v11, since modern browsers now support `