-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: breaking - drop CSS inlining and
<style>
tag removal by default
- Loading branch information
Showing
5 changed files
with
96 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "email-templates", | ||
"description": "Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more! Made for Forward Email and Lad.", | ||
"description": "Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for Forward Email and Lad.", | ||
"version": "10.0.1", | ||
"author": "Nick Baugh <[email protected]> (http://niftylettuce.com)", | ||
"bugs": { | ||
|
@@ -11,33 +11,33 @@ | |
"Nick Baugh <[email protected]> (http://niftylettuce.com)" | ||
], | ||
"dependencies": { | ||
"@ladjs/i18n": "^8.0.1", | ||
"@ladjs/i18n": "^8.0.3", | ||
"consolidate": "^0.16.0", | ||
"get-paths": "^0.0.7", | ||
"html-to-text": "^8.2.0", | ||
"juice": "^8.0.0", | ||
"html-to-text": "^9.0.3", | ||
"juice": "^8.1.0", | ||
"lodash": "^4.17.21", | ||
"nodemailer": "^6.7.7", | ||
"nodemailer": "^6.9.1", | ||
"preview-email": "^3.0.7" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.0.3", | ||
"@commitlint/config-conventional": "^17.0.3", | ||
"ava": "^4.3.1", | ||
"@commitlint/cli": "^17.4.2", | ||
"@commitlint/config-conventional": "^17.4.2", | ||
"ava": "^5.2.0", | ||
"cheerio": "^1.0.0-rc.12", | ||
"cross-env": "^7.0.3", | ||
"ejs": "^3.1.8", | ||
"eslint": "^8.20.0", | ||
"eslint": "^8.33.0", | ||
"eslint-config-xo-lass": "^2.0.1", | ||
"fixpack": "^4.0.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^13.0.3", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.1.1", | ||
"nodemailer-sendgrid": "^1.0.3", | ||
"nyc": "^15.1.0", | ||
"pug": "^3.0.2", | ||
"remark-cli": "^11.0.0", | ||
"remark-preset-github": "^4.0.4", | ||
"xo": "^0.51.0" | ||
"xo": "^0.53.1" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const path = require('node:path'); | ||
const fs = require('node:fs'); | ||
const test = require('ava'); | ||
const nodemailer = require('nodemailer'); | ||
const cheerio = require('cheerio'); | ||
|
@@ -36,6 +36,7 @@ test('inline css with juice using render without transport', async (t) => { | |
from: '[email protected]' | ||
}, | ||
juiceResources: { | ||
applyStyleTags: true, | ||
webResources: { | ||
relativeTo: root | ||
} | ||
|
@@ -468,6 +469,29 @@ test('send email with missing text template', async (t) => { | |
t.regex(message.text, /This is just a html test/); | ||
}); | ||
|
||
test('does not inline css with juice using render by default', async (t) => { | ||
const email = new Email({ | ||
views: { root }, | ||
message: { | ||
from: '[email protected]' | ||
}, | ||
transport: { | ||
jsonTransport: true | ||
}, | ||
juiceResources: { | ||
webResources: { | ||
relativeTo: root | ||
} | ||
} | ||
}); | ||
const html = await email.render('test/html', { | ||
name: 'test' | ||
}); | ||
const $ = cheerio.load(html); | ||
const color = $('p').css('color'); | ||
t.is(color, undefined); | ||
}); | ||
|
||
test('inline css with juice using render', async (t) => { | ||
const email = new Email({ | ||
views: { root }, | ||
|
@@ -478,6 +502,7 @@ test('inline css with juice using render', async (t) => { | |
jsonTransport: true | ||
}, | ||
juiceResources: { | ||
applyStyleTags: true, | ||
webResources: { | ||
relativeTo: root | ||
} | ||
|
@@ -501,6 +526,7 @@ test('inline css with juice using send', async (t) => { | |
jsonTransport: true | ||
}, | ||
juiceResources: { | ||
applyStyleTags: true, | ||
webResources: { | ||
relativeTo: root | ||
} | ||
|