@dbx-tools/email 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -144,6 +144,40 @@ const html = emailHtml.renderEmailHtml({
|
|
|
144
144
|
`markdown.markdownToHtml()` renders Markdown. `emailHtml.renderEmailHtml()` wraps
|
|
145
145
|
the rendered body in the package layout and inlines CSS for mail clients.
|
|
146
146
|
|
|
147
|
+
## Brand The Email
|
|
148
|
+
|
|
149
|
+
Branding is optional. Pass a `brand` to the plugin (or to `renderEmailHtml`) to
|
|
150
|
+
color the layout with an accent, font, and header logo; omit it for the neutral
|
|
151
|
+
default palette.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { brand, plugin } from "@dbx-tools/email";
|
|
155
|
+
|
|
156
|
+
// The dbx-tools brand, ready to use:
|
|
157
|
+
plugin.email({ brand: brand.defaultEmailBrand });
|
|
158
|
+
|
|
159
|
+
// Or derive from any shared BrandContext:
|
|
160
|
+
import { brand as coreBrand } from "@dbx-tools/shared-core";
|
|
161
|
+
plugin.email({ brand: brand.emailBrandFromContext(coreBrand.defaultBrandContext) });
|
|
162
|
+
|
|
163
|
+
// Or hand-build the small email-safe slice:
|
|
164
|
+
plugin.email({
|
|
165
|
+
brand: {
|
|
166
|
+
accent: "#FF3621",
|
|
167
|
+
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif",
|
|
168
|
+
name: "Acme",
|
|
169
|
+
logoUrl: "https://acme.example/logo.svg", // http(s): or data: only
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The brand is inlined into every rendered message. The browser UI's `[data-brand]`
|
|
175
|
+
CSS bridge can't reach an inbox (mail clients strip `<style>` and ignore `var()`),
|
|
176
|
+
so email branding uses inline token values instead. A `logoUrl` renders only when
|
|
177
|
+
it is an `http(s):` or `data:` URL - a package-export asset path is dropped rather
|
|
178
|
+
than shown as a broken image, so `defaultEmailBrand` applies the brand color and
|
|
179
|
+
font but no logo.
|
|
180
|
+
|
|
147
181
|
## Use The Outbox In Tests
|
|
148
182
|
|
|
149
183
|
```ts
|
package/package.json
CHANGED
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"juice": "^12.1.1",
|
|
20
20
|
"marked": "^18.0.5",
|
|
21
21
|
"nodemailer": "^7.0.13",
|
|
22
|
-
"@dbx-tools/shared-core": "0.3.
|
|
23
|
-
"@dbx-tools/shared-email": "0.3.
|
|
22
|
+
"@dbx-tools/shared-core": "0.3.21",
|
|
23
|
+
"@dbx-tools/shared-email": "0.3.21"
|
|
24
24
|
},
|
|
25
25
|
"main": "index.ts",
|
|
26
26
|
"license": "UNLICENSED",
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"version": "0.3.
|
|
30
|
+
"version": "0.3.21",
|
|
31
31
|
"types": "index.ts",
|
|
32
32
|
"type": "module",
|
|
33
33
|
"exports": {
|